Support

Home Forums Event Espresso Premium Dynamic Sidebar

Dynamic Sidebar

Posted: June 13, 2015 at 8:38 am

Viewing 2 reply threads


asse2014

June 13, 2015 at 8:38 am

Attempting to use different sidebars based on content, have everything working except for the Event Espresso Details page

<?php
$sidebar_name = get_post_meta($post->ID,”_page_sidebar_widget”,true);
dynamic_sidebar($sidebar_name);

if (in_category(‘9’)) {
dynamic_sidebar(‘News Sidebar’);
}
elseif (in_category(’10’)) {
dynamic_sidebar(‘Jobs Sidebar’);
}
elseif (in_category(‘espresso_events’)) {
dynamic_sidebar(‘Events Sidebar’);
}
elseif (is_single() || is_archive() || is_category() || is_search() || is_404()) {
dynamic_sidebar(‘Blog Sidebar’);
}
?>


Dean

June 15, 2015 at 2:01 am

Hi,

Did you create a category called “espresso_events”?

By default “espresso_events” is not a post category nor is it an Event Category category (Event Categories are a custom taxonomy attached only to events).

I would look to use either get_post_type (https://codex.wordpress.org/Function_Reference/get_post_type) or perhaps is_post_type_archive (https://codex.wordpress.org/Function_Reference/is_post_type_archive) depending on where you are adding these sidebars.

Then use a basic if statement to check if the post type equals espresso_events.

With get_post_type you *might* need to call global $post but I would try with the default example that uses get_the_ID() first and see how that goes.


asse2014

June 15, 2015 at 11:07 am

Dean,

Thanks for the quick response. The get_the_ID() solution worked perfectly.

Viewing 2 reply threads

The support post ‘Dynamic Sidebar’ 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