Skip to content

Kirby 4.4.1

$page->hasAudio()

Checks if the Files collection has any audio files

$page->hasAudio(): bool

Return type

bool

Parent class

Kirby\Cms\Page

Example

<?php
echo $page->hasAudio(); //will echo 1 if true, nothing if false

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