Title: If statement
Last modified: August 20, 2016

---

# If statement

 *  Resolved [scottcarlton](https://wordpress.org/support/users/scottcarlton/)
 * (@scottcarlton)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/if-statement-3/)
 *  so that if no pdf is uploaded there is no download button. I have tried a few
   things but just get errors. Any help with this would be great?
 * <?php query_posts(‘post_per_page=-1&post_type=properties’);
 *  while (have_posts()) : the_post(); ?>
 *  <article class=”property-wrap”>
 *  <?php
    $contact_name = getData(“contact_name_field”); // The cover image field
   value $contact_email = getData(“contact_email_field”); // The cover image field
   value $property_address = getData(“property_address_field”); // The book title
   text field value $size = getData(“property_size_field”); // The cover image field
   value $tenants = getData(“property_tenants_field”); // The book title text field
   value $download = getData(“property_pdflink_field”); ?> <img src=”[http://dummyimage.com/280×150/333/fff&text=property](http://dummyimage.com/280×150/333/fff&text=property)
   image” />
 *  <h2><?php the_title(); ?></h2>
    <lable>Location</lable> <p><?php echo $property_address?
   ></p> <lable>Size</lable> <p><?php echo $size ?> sq ft</p> <lable>Co-Tenants</
   lable> <p><?php echo $tenants ?></p> <lable>Contact</lable> ” class=”property-
   contact”> <span></span><?php echo $contact_name ?> ” class=”download rounded-
   corner”>Download PDF ” class=”more-info rounded-corner”>More Info
 *  </article>

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Rachel Baker](https://wordpress.org/support/users/rachelbaker/)
 * (@rachelbaker)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/if-statement-3/#post-2409017)
 * You could do something like this:
 *     ```
       <?php if (!empty ( $download)) :?>
       <a class="download rounded-corner">Download PDF</a>
       <?php endif;?>
       ```
   
 *  Thread Starter [scottcarlton](https://wordpress.org/support/users/scottcarlton/)
 * (@scottcarlton)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/if-statement-3/#post-2409114)
 * Perfect! Thanks for the quick reply. I was leaving out the !empty.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘If statement’ is closed to new replies.

## Tags

 * [if statement](https://wordpress.org/support/topic-tag/if-statement/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [scottcarlton](https://wordpress.org/support/users/scottcarlton/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/if-statement-3/#post-2409114)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
