Title: ACF IF statement shortcode
Last modified: December 2, 2021

---

# ACF IF statement shortcode

 *  [markyeoj](https://wordpress.org/support/users/markyeoj/)
 * (@markyeoj)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/acf-if-statement-shortcode/)
 * Hi, what is the shortcode equivalent of this if statement?
 *     ```
       <?php
   
       if(get_field('field_name'))
       {
       	echo '<p>' . get_field('field_name') . '</p>';
       }
   
       ?>
       ```
   
 * Thank you.

Viewing 1 replies (of 1 total)

 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/acf-if-statement-shortcode/#post-15126899)
 *     ```
       [if field=field_name]
        <p>[field name]</p>
       [/if]
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘ACF IF statement shortcode’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [polarracing](https://wordpress.org/support/users/polarracing/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/acf-if-statement-shortcode/#post-15126899)
 * Status: not resolved