Title: wordpress get_field IF statement
Last modified: August 22, 2016

---

# wordpress get_field IF statement

 *  [kieranreeves](https://wordpress.org/support/users/kieranreeves/)
 * (@kieranreeves)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/wordpress-get_field-if-statement/)
 * `<li><span class="icons orange fa fa-check"></span><?php echo get_field("reason_6");?
   ></li>`
 * How can i get the above line into an if statement where if the field is empty
   it doesn’t display but if there is something in there then it displays on the
   page. Im new to PHP so would like to know.

Viewing 1 replies (of 1 total)

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/wordpress-get_field-if-statement/#post-5578992)
 *     ```
       <?php $value = get_field ('reason_6'); ?>
       <?php if (strlen ($value) > 0): ?>
           <li><?php echo $value; ?></li>
       <?php endif; ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘wordpress get_field IF statement’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/wordpress-get_field-if-statement/#post-5578992)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
