Skip Navigation

[Resolved] Filtering and ordering events with _EventStartDate value (Tribe events)

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by davidS-72 1 year, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#2613843
view_on_page.jpg
shortcode-now.jpg

Tell us what you are trying to do? I want to show 4 events at home from the plugin Calendar tribe events. The 4 events have to be from today and next 4 events.

Is there any documentation that you are following? Yes, https://toolset.com/forums/topic/filtering-by-date-field-from-cpt-the-events-calendar/
I've done:
- I've created a shortcode "now" (captures attached)
- I've filtered content with the shortcode (captures attached)

...But it doesn't works.

Is there a similar example that we can see? hidden link at home, row "FEM AGENDA!" but with the events from today date and the next 4

What is the link to your site? hidden link at home, row "FEM AGENDA!"

#2614205

Hello,

I assume we are talking about the "The Events Calendar" plugin, download from:
https://wordpress.org/plugins/the-events-calendar/

According to their document:
hidden link
This plugin only shows current and upcoming events by default, so in your case, it does not need to use custom codes to add the date filter at all, you just need to display only 4 items in the post view's setting

#2615229

Hello Lou,
I'm using toolset to display the events. I think the problems is the filter in toolset.

best regards,
David

#2615315

The "The Events Calendar" plugin stores date field value in string format, for example:
2023-06-15 00:00:00

So you will need to change your custom shortcode:
https://toolset.com/wp-content/uploads/2023/06/2613843-shortcode_now.jpg
For example:

return date('Y-m-d');

And test again

#2615391

I've changed the custom code but it doesn't works.

add_shortcode('now', function () {
return date( 'Y-m-d' );
});

best regards,
David

#2615679

I have tried the same custom shortcode in a fresh WP installation + the latest version of Toolset plugins + "The Events Calendar" plugin, it works fine.

See below sandbox website:
Login URL: hidden link

Page with view block + view shortcode:
hidden link
Same settings as your screenshots, it works fine in frontend:
hidden link
See the second post view below text "With shortcode attribute"
Can you reproduce the same problem in above sandbox website?

And you will need to add the custom shortcode name "now", in Toolset setting:
hidden link
option "Third-party shortcode arguments"

#2617027

My issue is resolved now. Thank you!