Hi,
I followed your tutorial to set up a custom events list template, using method 3 (‘like a pro’):
https://wp-event-organiser.com/blog/tutorial/creating-your-own-events-page/
While steps 1-2 work fine, step 3 (Choosing a template) does some weired things. When having the plugin setting Templates >> Theme handling on, the template_include filter remains without any effect.
That means, the default template is used instead of my custom template. However, when I echo the template variable right before the return statement in my_custom_events_page_template function, the correct template path is displayed.
In your tutorial, there’s no hint which says, template handling must be switched off to use custom event templates, is there?
So, how to get my custom template get used, with the respective query variable in the URL?
Thanks,
Ron
Ron
Hi Ron,
That tutorial is about creating your own custom page – and the templating options are independent of any setting in Event Organiser. template_include
is a WordPress filter and will always fire.
So, your my_custom_events_page_template()
is being triggered (as it should be). As for why this is not having an effect there could be one or two reasons for this:
- You’re not returning the template file path in the function
- Another plug-in/theme is over-riding your setting
You can assign a larger number than 20 to give it higher priority to overcome (2). It maybe worth trying to find out what is over-riding your template location (and why) – there is a plugin called Query Monitor which is useful for this.
Stephen Harris