Ed
(@erishel)
Hey there,
Thanks for reaching out 😀
Do you have a link that you can share so we can see what you’re referring to?
Take care,
Ed 🤘
Thread Starter
mrqwak
(@mrqwak)
Thanks for taking a look Ed.
http://staging.woodseatschess.org.uk/
As you can see, on the homepage in the main content area, it is showing all events, including those that will take place in the future.
The behaviour I want is for future events only to be showed in the sidebar (that’s working fine), with only past events to be shown mixed in with regular blog posts.
Hope that makes sense. Any suggestions very much apprecieated.
Thanks,
Jamie
Thread Starter
mrqwak
(@mrqwak)
Hi Ed,
Could you respond please?
Or if it’s not something you can help with, could you kindly say so, so I can look elsewhere for help.
Many thanks,
Jamie
Ed
(@erishel)
Hey Jamie,
Sorry about the wait! We’ve seen a surge in support requests lately.
It looks like you are including your events within your blog loop — this makes it a bit more difficult to filter out those events.
Essentially what you’ll need to do here is create a custom query. I’m limited to the amount of support I can provide here, but this is a good example:
$args = array(
'post_type' => 'tribe_events', // Specify the CPT, this way we aren't filtering posts as well
'orderby' => 'meta_value', // We want to organize the events by date
'meta_key' => '_EventStartDate', // Grab the "start date" (stored in YYYY-MM-DD format)
'order' => 'ASC', // ASC is the other option
'posts_per_page' => '10', // How many events to show?
'meta_query' => array( // WordPress has all the results, now, return only the events after today's date
array(
'key' => '_EventStartDate', // Check the event start date
'value' => date("Y-m-d"), // Set today's date (note the similar format)
'compare' => '>=', // Return the ones greater than or equal to today's date
'type' => 'DATE' // Let WordPress know we're working with date
)
)
);
Hope that helps!
Take care,
Ed 🤟