Support

Account

Home Forums General Issues Display if not empty Reply To: Display if not empty

  • Also a descent touch if not overused (since it worsens readability) is to do:

    
    <?php if( $county = get_field('county') ) { ?>
    	<?php echo $county . ' County' ; ?>
    <?php } ?>
    

    That will only call to the get_field function once thus saving you some resources. However as I said some would argue that this is bad practise as it can be harder to read (for humans) especially when it gets more complicated with many if statements etc.