Support

Home Forums Event Espresso Premium Conditional statements on registration_page_display.php

Conditional statements on registration_page_display.php

Posted: May 1, 2013 at 12:25 pm


Andrew Smith

May 1, 2013 at 12:25 pm

Hello, I am wanting to write a few conditional statements based on the category of an event.

 

I wanting to write these conditional statements into “registration_page_display.php”.

 

Basically, I just want to do this:

If this event is in X category, show some specific content
Else, if this event is in Y category, show this other content

Pretty basic conditional stuff, I just don’t know event espresso well enough to know what to use!

 

Any help is greatly appreciated.


Andrew Smith

May 1, 2013 at 2:23 pm

Is there a function like “is_category(‘category_id’);” ??


Andrew Smith

May 1, 2013 at 2:53 pm

I will most likely end up using pages and shortcodes…


Dean

May 2, 2013 at 3:26 am

Hi Andrew,

Some thing like this may get you started

<?php

$blah = espresso_event_category_data($event_id, $all_cats = TRUE); // use false if you dont want just one.

$blahz = $blah['category_identifier'];

$blahz = str_replace ( " ", "", $blahz ); //strip spaces out!


if($blahz == "rock") { echo "YEY!!!!!!!!!!!!!!!!!!!!"; }

?>

If you have multiple categories per event you may need to add in a foreach to go through the array to check the category marker is there or not.


Andrew Smith

May 4, 2013 at 4:15 pm

Hi Dean, I appreciate the response! But, I’m in the midst of switching everything over to pages and using shortcodes for everything. I’ve ran into a problem (or complaint at least) while doing that, I’m going to start a new topic for it.

 

Thanks again

The support post ‘Conditional statements on registration_page_display.php’ 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