I have very basic php skills at the moment. I’m using a WordPress plugin called Advanced Custom Fields. I have the basics down and have it working. It is echoing the results of the filled in field. What I want to do is have the title of the field only show if the field has been filled. For example, if the user has filled out the field for (number of bedrooms) and chooses 4. The Echo would show as Bedrooms: 4
But, if the user does not fill in that part of the form, I don’t not want it to show Bedrooms:
This is what I’m using right now, how can I hide that Bedrooms:? in an if statement?
<?php if ( !is_front_page() ) { ?>
<div class="post-list_h">
<?php } ?>
<?php if ( $instance['bedrooms'] ) : ?>
<h4 class="customFields_widget">Bedrooms: <?php the_field('bedrooms'); ?></h4>
<?php endif; ?>
Try this :
What is considered empty according to the Php doc is :