[Plugin: The Events Calendar] Using Event Queries in Admin Interface
-
Hello,
I am using the Newsletter Plugin and want it to automatically display the next upcoming events in every new Email. So I used a query in the Newsletter Theme that already works in the same project. But in this case I get 3 “random” events, but not the upcoming.
After hours of debugging in TEC and WordPress I found out, that the function TribeEventsQuery->setupQuery(), which seems to be responsible for translating all the event-related stuff in the query like “upcoming”=>”startdate > today”, is not executed in admin mode. This behavious seems to be intended, because it says “if ( !is_admin() && … ” at the beginning of the function.
When I remove the !is_admin() condition, it works.
So my 2 questions:
1) Why?
2) What can I do?Thanks!
(I’m using TEC 2.0.8)
My Query:
get_posts(array( 'post_type' => TribeEvents::POSTTYPE, 'orderby' => 'event_date', 'order' => 'ASC', "eventDisplay"=> "upcoming", "numberposts" => 3 ));
The topic ‘[Plugin: The Events Calendar] Using Event Queries in Admin Interface’ is closed to new replies.