I am trying to call a field and it's heading on a post type. I want to call headings only if there is content in the field. I'm really new to PHP and am unsure how it all works. I have added the following script in content-single.php
<?php $field = get_field('introduction');
if(!empty && is_array){
?>
<div class="sc-project-type">
<h4>Introduction:</h4>
<?php //$terms = get_the_terms($post->ID, 'project_type');
echo '$field'; ?>
</div>
<?php } ?>
This brakes produces nothing. If I just , it works, but I want to add lots of fields that won't always be visible. Any ideas?
empty()
andis_array()
are both functions but you've left off the parens and the arguments. If you have debugging enabled you'd probably see warnings about undefined constants. At any rate, it won't work as you need it to.