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

Checks if the site has a certain field

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

Example

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