$page->content()->has($field)

Checks if the page has a certain field

  • $field (string)
    A field name
  • return (boolean)

Example

<?php
if($page->content()->has('somefield')) {
  echo $page->somefield()->kirbytext();
}
?>