Title: Conditional logic with ACF fields
Last modified: May 24, 2020

---

# Conditional logic with ACF fields

 *  [Curtis](https://wordpress.org/support/users/curtis782/)
 * (@curtis782)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/conditional-logic-with-acf-fields/)
 * I have 4 ACF fields: contact1_first_name, contact1_last_name, contact1_title,
   contact1_email.
 * I am able to display these using the following:
    [field key=contact1_first_name][
   field key=contact1_last_name], [field key=contact1_title], [field key=contact1_email]
 * I would like to take the next step and conditionally display title and email (
   with associated comma) only if I have this data. How can I do this?
 * Thanks very much.

Viewing 1 replies (of 1 total)

 *  [codemonkeynorth](https://wordpress.org/support/users/codemonkeynorth/)
 * (@codemonkeynorth)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/conditional-logic-with-acf-fields/#post-12904900)
 *     ```
       [if not field=contact1_email]
       No email supplied
       [else]
       [field key=contact1_email]
       [/if]
       ```
   
 * or
 *     ```
       [if field=contact1_email]
       Email: [field contact1_email]
       [/if]
       ```
   
 * check out `[if exists]` as well, I believe it is used to check if the actual 
   field is even present on the post, rather to check the value
 * find the docs under /wp-admin/options-general.php?page=ccs_reference&tab=if

Viewing 1 replies (of 1 total)

The topic ‘Conditional logic with ACF fields’ 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: [codemonkeynorth](https://wordpress.org/support/users/codemonkeynorth/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/conditional-logic-with-acf-fields/#post-12904900)
 * Status: not resolved