Title: Conditional Custom Attributes
Last modified: August 21, 2016

---

# Conditional Custom Attributes

 *  Resolved [dadadmin](https://wordpress.org/support/users/dadadmin/)
 * (@dadadmin)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/)
 * I created a custom attribute #_ATT{Buy Tickets} to link to external ticketmaster
   links. I got everything to work and output correctly, however, some events are
   free and therefore don’t have a buy tickets button.
 * Is it possible on my [events_list] code to output the #_ATT{Buy Tickets} ONLY
   if there is a value filled in for that attribute on the event listing?
 * [http://wordpress.org/plugins/events-manager/](http://wordpress.org/plugins/events-manager/)

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

 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549234)
 * That will happen anyway – if there’s no value for #_ATT{Buy Tickets} nothing 
   will be printed on the screen.
 *  Thread Starter [dadadmin](https://wordpress.org/support/users/dadadmin/)
 * (@dadadmin)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549346)
 * It’s not quite working like that.. here is my page
    [http://192.185.167.175/~laurente/belle/entertainment/](http://192.185.167.175/~laurente/belle/entertainment/)
 * One event has tickets, one event doesn’t
 * My shortcode for the page is [Buy Tickets](https://wordpress.org/support/topic/conditional-custom-attributes/?output_format=md#_ATT{Buy Tickets})
 * It’s outputting the buy tickets button even when i leave the custom attribute
   on the event listing field blank
 *  Thread Starter [dadadmin](https://wordpress.org/support/users/dadadmin/)
 * (@dadadmin)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549347)
 * Whoops! It hardcoded the short code
 * a href=”#_ATT{Buy Tickets}”Buy Tickets
 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549366)
 * Sorry, I’m confused. Both the events on that page have the same HTML for the 
   Buy Ticket button. What am I missing? Thanks.
 *  Thread Starter [dadadmin](https://wordpress.org/support/users/dadadmin/)
 * (@dadadmin)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549367)
 * I am going to have a full list of event, some of these events will be free, and
   therefore wont need a buy tickets button, some of them will cost money and need
   to be linked to an external site to purchase the tickets.
 * I created the custom attribute for the events listing to link to whatever I set
   the custom attribute to on the individual event.
 * I want my event listing to only output the custom attribute if I actually have
   a url filled into the custom attribute field.
 * It’s displaying the buy ticket button for an event that does not have anything
   filled into the buy tickets field in the event listing.
 * I think the solution I am looking for is some kind of conditional on the attribute
   where the shortcode for the attribute only appears if there is a value for the
   attribute inside an individual listing, however, I do not know how to do that.
 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549374)
 * Sounds like you need to wrap the HTML code for your Buy Ticket button in the {
   not_free} conditional placeholder. Like this:
 * `{not_free}HTML code here{/not_free}`
 * [http://wp-events-plugin.com/documentation/conditional-placeholders/](http://wp-events-plugin.com/documentation/conditional-placeholders/)
 *  Thread Starter [dadadmin](https://wordpress.org/support/users/dadadmin/)
 * (@dadadmin)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549375)
 * is the not free code linked directly to the built in booking system? My ticket
   button is for an external ticket booking system. I created it as a custom attribute
   because it links to an external url in a new tab.
 * If I attach that conditional placeholder, it makes the ticket link disappear 
   for an event that has a buy ticket button attribute
 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549393)
 * Yes, if you give your event at least one non-free ticket the conditional tag 
   will show the Buy Ticket button.
 * You may want to edit the single event template to hide the Events Manager booking
   form and show your Buy Ticket button there too.
 *  Thread Starter [dadadmin](https://wordpress.org/support/users/dadadmin/)
 * (@dadadmin)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549405)
 * I think my ticket terminology is confusing things.
 * Essentially, I just need a custom attribute that is a button that links to an
   external url.
 * 
 * I need the whole div and the contents within the div to not display if there 
   is no value in that attribute. Right now, the div is not outputting a specific
   value if I do not define one, however, the div itself is still displaying on 
   the page.
 * [http://192.185.167.175/~laurente/belle/promotions/](http://192.185.167.175/~laurente/belle/promotions/)
   
   Bobby rush has a value for buy tickets, and it links to that url Hot 8 Brass 
   Band has no value for buy tickets, so it doesn’t link anywhere but the button
   itself still shows up
 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549410)
 * maybe this link can help you out – [http://snippets.webaware.com.au/snippets/events-manager-conditional-placeholders-for-custom-attributes/](http://snippets.webaware.com.au/snippets/events-manager-conditional-placeholders-for-custom-attributes/)

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

The topic ‘Conditional Custom Attributes’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [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/)

 * 10 replies
 * 3 participants
 * Last reply from: [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/conditional-custom-attributes/#post-4549410)
 * Status: resolved