Home › Forums › Calendar Products › Events Calendar PRO › Exclude Past Events from Query
- This topic has 4 replies, 3 voices, and was last updated 11 years, 5 months ago by Barry.
-
AuthorPosts
-
November 19, 2012 at 8:45 pm #28266JasonParticipant
I’m having trouble preventing past events from showing in certain areas of my site. I’ve set ‘eventDisplay’ => ‘upcoming’ but past events are still coming through.
Here is my full query:
$my_query = new WP_Query( array(
‘post_type’ => ‘tribe_events’,
‘post__in’ => get_option( ‘sticky_posts’ ),
‘eventDisplay’ => ‘upcoming’,
‘posts_per_page’ => 3
) );I’m using the Sticky Custom Post Types plugin to pull these posts into a slideshow, per Jonah’s suggestion in a support thread, which is why I have get_option(‘sticky_posts’) included. I’ve tested this with all other plugins except for Sticky Custom Post Types deactivated and still encountered the issue.
Any help in resolving this issue would be greatly appreciated.
Thanks,
Jason
November 20, 2012 at 4:05 am #28271SandroParticipantI’ve similar problem, upcoming filter for me is not working. I’ve past events showing up in widget with code similar to yours and also in list.php
https://theeventscalendar.com/support/forums/topic/single-day-view-displaying-past-day-events/
There is a bug I think.
November 20, 2012 at 7:46 am #28281BarryMemberHi Jason, I’m not sure that Tribe-specific conditions such as eventDisplay are respected in a new WP_Query.
November 20, 2012 at 1:29 pm #28302JasonParticipantIs there another method I should be using that will respect it? I’m trying to run multiple loops and output sticky posts in one div and the rest in another div that can be shown jQuery.
Here is the code for both loops that I’m using on my list.php file: http://pastebin.com/zrK1RK4u
I’ve noticed is that when an event isn’t sticky, it doesn’t appear in the second loop. Only the first loop has the problem.
November 20, 2012 at 9:27 pm #28311BarryMemberGenerally we recommend using tribe_get_events() if you need to run an event-related query, as that helps to ensure that the query is processed by The Events Calendar (otherwise non-standard keys like eventDisplay will most likely be ignored).
-
AuthorPosts
- The topic ‘Exclude Past Events from Query’ is closed to new replies.