Support

Home Forums Event Espresso Premium Passing ID to WP template Registration display / Page Template Conditionals

Passing ID to WP template Registration display / Page Template Conditionals

Posted: February 5, 2014 at 4:31 pm


artsguild

February 5, 2014 at 4:31 pm

I scraped this code off the forum for category conditionals.

I like this since I’d like to show more information related to a certain category. ‘Music’ category is my example, which works in the registration_display file.

I’d like to use this (code below) in the sidebar of my page template, which holds the [ESPRESSO_EVENTS] short code.

How do I pass the event ID to this code outside registration_display template?

<code>
$ee=$event_id; // I&#039;d like to pass the id 
$eecat = espresso_event_category_data($event_id, $all_cats = TRUE); // use false if you dont want just one.
$eecatz = $eecat[&#039;category_identifier&#039;];
$eecatz = str_replace ( &quot; &quot;, &quot;&quot;, $eecatz ); //strip spaces out!

if($eecatz == &quot;music&quot;) { 
get_template_part(&#039;music&#039;,&#039;block&#039;);
}
</code>

Thanks for your help with this.


Josh

  • Support Staff

February 6, 2014 at 1:53 pm

Hi there,

There’s a global variable that you can use in your custom function:

global $this_event_id;
$event_id = $this_event_id;


artsguild

February 13, 2014 at 9:18 am

Thanks Josh, I’ll check that out.


Dean

February 14, 2014 at 3:50 am

Please let us know if you have any further questions regarding this.

The support post ‘Passing ID to WP template Registration display / Page Template Conditionals’ 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