[Resolved] Events list won't show if main query is modified (Bug report?)
I’m trying to use The Events Calendar (v2.0.9) to display a list of events. The plugin works great (as usual), except that the main events listing/loop won’t display any entries. This is true regardless of if I’m trying to view upcoming events [~/events/upcoming/], past events [~/events/past/] or even just the main events view, if the plugin option is set that way [~/events/]. The calendar view displays just fine as do the single event pages.
I’ve narrowed down the issue to a modification I’m making to the main query, for the blog homepage. Here’s the code I’m using: http://pastebin.com/JDwAYNNm.
You’ll notice that I’m specifically making sure to only run my modifications on the main blog index (
is_home) and only on the main query (
$query->is_main_query()). However, my action still runs when viewing the events listing page (any of the above mentioned relative links).
I’ve narrowed down the issue to my
is_home()condition in the code above. It appears as though TEC sets
is_hometo true when viewing any of the listing pages. With this condition set, my query modification also runs for the events listings and therefore no events show.
All that to say, is there a specific reason TEC sets
is_hometo true when viewing an events listing? To me it appears to be a bug. If there is a legitimate reason for setting
is_home, would you have a suggestion for a work around for my conditional query modification so that both the query mod and the events listings can work on the same site?
Thanks for the help!
- The topic ‘[Resolved] Events list won't show if main query is modified (Bug report?)’ is closed to new replies.