Support

Home Forums Event Espresso Premium Conditional statements based on event categories

Conditional statements based on event categories

Posted: December 23, 2012 at 8:34 am

Viewing 2 reply threads


Post Creative

December 23, 2012 at 8:34 am

Hi I’d like to show different layouts in my template for different kind of events so I want to be able to do some if statments based on categories but also on meta tags too if possible. Here is an example of how I’m trying to only showing the register button for certain categories of events

<a href="http://dev.schoolforstartupscommunity.net/event-registration/?ee=">Register

 Is it just my inexperience with php or am I missing something important ? Nova
  • This topic was modified 12 years ago by Post Creative. Reason: code didn't display properly
  • This topic was modified 12 years ago by Post Creative.
  • This topic was modified 12 years ago by Post Creative.


Post Creative

December 23, 2012 at 8:40 am

I’ve tried over and over again to post the code but I’m not having any luck – could you please give me an example of using event categories in this way or I could send the code by email.

thanks

Nova


Josh

  • Support Staff

December 24, 2012 at 9:26 am

Hi Nova,

A better way to post code is by using a service like pastebin or a github gist and link to the code here. That said, we do not typically help out with specific customizations. I can point you to some shortcodes and examples in the existing template code that may help.

The first example is the event category shortcode. If you wanted to have a different layout on the registration page depending on the category of the event, you could add the category shortcode to a div class like this:

<div class="<?php echo do_shortcode('[CATEGORY_NAME event_id="'.$event_id.'"]');?>">

<?php //template code here

</div>

Then you can target that div with CSS by specifying the class name/category name in the stylesheet.

Another example that can be used is the ee_meta, which can also be used to add specific hooks to the templates.

I do have one question about where you’re trying to only show the register for specific categories. Which template are you working with?

Viewing 2 reply threads

The support post ‘Conditional statements based on event categories’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso