WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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; ?>
share|improve this answer
wow, yup, that easy huh? thank you very much!!!! – user31344 Nov 20 '13 at 17:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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