Posted: February 25, 2015 at 9:51 am
|
I would like to implement 2 or more different event list views. So in the main content area and sidebar respectively I use: The template content-espresso_events.php has been copied into the child theme twice and modified to give 2 views: These I can load from the events template file, wp-content/themes/my-child-theme/loop-espresso_events.php, using espresso_get_template_part( ‘content’, ‘espresso_events-list’ ); All ok so far. My question is how can I determine which to load? How can I determine when loop-espresso_events.php is running in the main content area and when running in the sidebar? Or perhaps I should be having multiple versions of loop-espresso_events.php instead and ‘splitting further up the chain’ I’d like to have available such functions such as “is_sidebar()” or “template_name()”. Forgive my terminology, I’ve been a Windows developer my working life and not yet devoted the time to really understanding WordPress development inside out – I appreciate this is probably a WordPress Development issue rather than EE4 specifically. Many thanks |
Hi there, I can advise using get_sidebar(); to load in your custom sidebar. You’ll can make this happen using a page template or in archive-espresso_events.php. Along with that, here’s little tip on making things simple so you don’t end up making a bunch of templates that include different shortcodes for each category: You can load up the native category archive by going to yoursite.com/event-category/your-category-name. This view will typically use the archive.php template from your theme, but it will first check for archive-espresso_events.php and before that it will check for taxonomy-espresso_event_categories.php. |
|
The support post ‘Implementing Multiple Event Templates’ 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.