Title: Multiple Custom Event Attributes &#8211; conditional display
Last modified: August 21, 2016

---

# Multiple Custom Event Attributes – conditional display

 *  Resolved [RetroTorque](https://wordpress.org/support/users/retrotorque/)
 * (@retrotorque)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/)
 * Hi,
 * I found this [thread](http://wordpress.org/support/topic/plugin-events-manager-custom-conditional-placeholder-not-working),
   where @agelonwl very usefully explains how to add conditional display of Custom
   Event Attributes. (It’s agelonwl last piece of code in the thread I’m using.)
 * I’ve pasted that code into my theme functions.php file. It works!!
 * However, that’s for just one Event Attribute – **#_ATT{venue_url}**.
 * I thought that I could just simply copy the code multiple times, once for each
   Event Attribute (with relevant modifications each time). But that doesn’t work.
 * I’d be very grateful if someone could explain how to modify the code for use 
   with more than one Event Attribute.
 * #_ATT{Email}
    #_ATT{Facebook URL}
 * For example.
 * Many thanks.
 * [https://wordpress.org/plugins/events-manager/](https://wordpress.org/plugins/events-manager/)

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

 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/#post-4698585)
 * you need to make another version of the snippet and rename the function name 
   attribute
 * eg.
 *     ```
       has_venueurl
       $EM_Event->event_attributes['venue_url'])
       my_em_has_attribute_event_output_condition
       ```
   
 * to something like
 *     ```
       has_email
       $EM_Event->event_attributes['Email'])
       my_em_has_attribute_event_output_condition_email
       ```
   
 *  Thread Starter [RetroTorque](https://wordpress.org/support/users/retrotorque/)
 * (@retrotorque)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/#post-4698590)
 * Thanks very much, that’s brilliant!
 * One last question.
 * Is it possible to write the conditional so that it includes an ‘and / or’ statement?
 * This would be useful for headings eg:
 * {has_facebookurl} and /or {has_twitterurl}
 * **Social Media**
 * {/has_facebookurl} and / or {/has_twitterurl}
 *  Thread Starter [RetroTorque](https://wordpress.org/support/users/retrotorque/)
 * (@retrotorque)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/#post-4698596)
 * Think I’ve got it, nesting seems to work.
 * As per the instructins at the bottom of the page:
 * [http://wp-events-plugin.com/documentation/conditional-placeholders/](http://wp-events-plugin.com/documentation/conditional-placeholders/)
 *  Thread Starter [RetroTorque](https://wordpress.org/support/users/retrotorque/)
 * (@retrotorque)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/#post-4698597)
 * Actually, I can’t get nesting to work for this purpose. It seems all conditionals
   have to be satisfied or the heading won’t display.
 * I’m still looking for an ‘or’ function.
 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/#post-4698603)
 * did you try to add this line in your wp-config.php?
 *     ```
       define('EM_CONDITIONAL_RECURSIONS',2);
       ```
   
 *  Thread Starter [RetroTorque](https://wordpress.org/support/users/retrotorque/)
 * (@retrotorque)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/#post-4698609)
 * Yes, I did, thanks.
 * I think I got it to work as it should. It’s just that it doesn’t do exactly what
   I want it to.
 * (In the case of two nested conditionals) it seems that both conditionals have
   to be met for the heading to be displayed. If only one is met, then the heading
   isn’t displayed.
 * This is my formatting code.
 *     ```
       {has_facebookurl}
       {has_twitterurl}
       <h2><strong><span style="color: #ff6600;">Social Media</span></strong><br/></h2>
       {/has_twitterurl}
       {/has_facebookurl}
       ```
   
 *  [Philip John](https://wordpress.org/support/users/philipjohn/)
 * (@philipjohn)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/#post-4698639)
 * Hiya,
 * Yes, there’s no way to do an ‘OR’ with the conditional placeholders. What you’d
   really need to do is add further conditionals like so to ensure your HTML is 
   only added once;
 *     ```
       {has_facebookurl}
       {not_have_twitterurl}
       <h2><strong><span style="color: #ff6600;">Social Media</span></strong><br/></h2>
       {/not_have_twitterurl}
       {/has_facebookurl}
       ```
   
 * and
 *     ```
       {has_twitterurl}
       {not_have_facebookurl}
       <h2><strong><span style="color: #ff6600;">Social Media</span></strong><br/></h2>
       {/not_have_facebookurl}
       {/has_twitterurl}
       ```
   
 * What would be much more productive though is something like;
 *     ```
       {show_socmed}
       <h2><strong><span style="color: #ff6600;">Social Media</span></strong><br/></h2>
       {/socmed}
       ```
   
 * and have your custom placeholder function do the necessary conditional legwork
   instead.
 * Thanks
 *  Thread Starter [RetroTorque](https://wordpress.org/support/users/retrotorque/)
 * (@retrotorque)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/#post-4698689)
 * Thanks philipjohn,
 * They are both useful bits of code. I didn’t know about {not_have_…}
 * Having the ‘custom placeholder function do the necessary conditional legwork’
   is certainly best. I’ll see what I can do with the code.
 * The {not_have_…} conditionals are useable in this example, when you only have
   a couple of statements you want to check. But I’ve another with 5, and then all
   the combinations you have to account for become much too many. (Plus all the 
   processing needed for all the nesting.)
 *  Thread Starter [RetroTorque](https://wordpress.org/support/users/retrotorque/)
 * (@retrotorque)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/#post-4698695)
 * …I understand now.
 * I’d have to create the {not_have_…} conditional myself.

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

The topic ‘Multiple Custom Event Attributes – conditional display’ is closed to 
new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=1039078)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [Event Attributes](https://wordpress.org/support/topic-tag/event-attributes/)

 * 9 replies
 * 3 participants
 * Last reply from: [RetroTorque](https://wordpress.org/support/users/retrotorque/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/multiple-custom-event-attributes-conditional-display/#post-4698695)
 * Status: resolved