June 11, 2021 at 12:45 am #31127
I really would like to use WPSP Pro to show our current events from The Events Calendar (TEC), it does show with this shortcode a list
[wp_show_posts id="18363" settings="orderby=start_date&order=DEC"]but it shows all our hundreds events and it should only show events where the end date is not passed.
Is there a way to do this?
By the way TEC build-in shortcodes to show events is visually terrible, therefor you can find lots of third party plugins all trying to earn some money but at the end I discovered our true and only WPSP Pro is doing it at it’s best!!
Keep up the good work
June 11, 2021 at 12:53 am #31130
- This topic was modified 5 days, 13 hours ago by Marcel.
BTW it also shows events that are not even published and thus planned for future publishingJune 13, 2021 at 8:16 pm #31178elvinModerator
This is quite tricky to do.
Does the events calendar plugin have any meta key that stores true or false if the end date has passed?
If it has one, we can use that meta value for filtering query results.
You can try asking TEC’s plugin developer for this. If they have one, we can use that for filtering things out.June 15, 2021 at 12:42 am #31191
after searching and looking into their php templates I guess the code below might be for “filtering” only events according to the settings in the plugin, how can we use this in WPSP?
$posts = tribe_get_list_widget_events(); <?php if ( $posts ) : // Check if any event posts are found. ?>
June 15, 2021 at 12:51 am #31194June 15, 2021 at 12:57 am #31196June 15, 2021 at 6:47 pm #31216elvinModerator
- This reply was modified 1 day, 13 hours ago by Marcel.
That snippet only checks if any event posts are found.
What we need to get is the meta value that stores if an event has passed.
This is quite complex, and to be honest, goes way out of the scope of support of the plugin because we’re basically integrating another unaffiliated third-party plugin to WP Show Posts.
This is complex because of the FF:
– We have to fetch the event end date of the event.
– After fetching the end date, we need to compare the end date to the current date to see if the event has passed.
– After making the true/false comparison, we need to build the query that only gets the posts that return true/false depending on the condition.
I did a bit of digging around and I found this function –
tribe_is_past_event()– which checks that.
You can try assigning the true/false value of this to a meta field and then do a meta query for this.
- You must be logged in to reply to this topic.