$page->hasAudio()

Checks if there are any audio files in the page's directory

  • return (integer)

Example

<?php
echo $page->hasAudio(); //returns the number of audio files in the folder

if($page->hasAudio()) {
  $audio = $page->audio();
}
?>

What is an audio file?

Kirby considers the following file types as audio files:

  • mp3
  • m4a
  • wav
  • aif
  • aiff
  • midi