I have a custom field set that is look to display like so:

<p><strong>Lease Rate:</strong>
        <?php the_field('lease_rate'); ?>
      <p> <strong>NNN Expenses:</strong>
        <?php the_field('nnn'); ?>
      <p> <strong>Monthly Rent:</strong>
        <?php the_field('rent'); ?>

       <p> <strong>Site Area:</strong>
        <?php the_field('site_area'); ?>
      <p><strong>Sale Price:</strong>
      <?php the_field('building_size'); ?></p>
      <p><strong>Building Size:</strong>
      <?php the_field('Address'); ?></p>
      <p><strong>Contact Name:</strong>
      <?php the_field('contact_name'); ?></p>
      <p><strong>Phone Number:</strong>
      <?php the_field('phone_number'); ?></p>

I need to change it so that:
IF the field is filled in, THEN the title shows up.

For example, if the_field lease_rate has a value then the paragraph "Lease Rate" shows up.

I was thinking some kind of if statement then echoing the p?


You can use the ACF API's get_field to test for the existence of data:

if( $lease_rate = get_field('lease_rate') ){
    <p><strong>Lease Rate:</strong>
        <?php echo $lease_rate; ?>
  • wow, yup, that easy huh? thank you very much!!!! – user31344 Nov 20 '13 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.