Skip Navigation

[Resolved] Hide past events (The Events Calendar) by filter in toolset View

This support ticket is created 4 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 11 replies, has 2 voices.

Last updated by antond-3 4 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#1818791
hide-events.jpg

I'm trying to hide past events from plugin "The Events Calendar" in a toolset View page.
I know now Time format of an Event is stored in database as a string instead of time. How can I managed this to get it work?

Found something like this
https://toolset.com/forums/topic/filter-by-custom-date-field-based-on-todays-date/
but I can't get it to work

Thank you!

#1819171

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anton,

Thank you for getting in touch.

Can you send me a screenshot of the query filters that you are currently using on your view to setup the date filter?

From there I should be able to let you know whats wrong.

Thanks,
Shane

#1819845
hide-events-query.jpg

Hi Shane,

Thanks for your reply. Hope you can figure this out.

Thanks!

#1821313

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anton,

Thank you for the screenshot. So for the most part your filter is correct, however instead of setting the filter to a string you need to set it to a number.

This is because the field is stored as a timestamp and the timestamp is a number so you will need to do the comparison logic as a number.

Please let me know if this helps.
Thanks,
Shane

#1822421

Hi Shane,
Thanks for your reply, but it doesn't helped.

"No items found"

Can it be something Else?

#1824933

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anton,

The solution should be changing it to a number unless Events calendar made a change.

Would you mind allowing me to have admin access to the site as well as a link to the page so that I can have a look ?

The private fields will be enabled for your next response.

Thanks,
Shane

#1826137

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anton,

Thank you for the credentials, however I need a link to the page where you are testing the view on.

Thanks,
Shane

#1827093

Ah yeah sorry, I've written it in the private post

#1827245

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anton,

So I went ahead and did some checks for you to see why this isn't working.

It turns out that the events calendar plugin is actually storing the values as an actual date and not a timestamp.

So in order to filter this you will need to use a custom hook. Here is an example below.
https://toolset.com/forums/topic/view-to-show-current-of-future-events-from-the-events-calendar/

The only thing you will need to change is the View ID array to just have your view's ID in it.

You can add the custom code in Toolset -> Settings -> Custom Code. Once you've done this please remember to activate the code.

Please let me know if this helps.
Thanks,
Shane

#1829887

Hi Shane,

Whare can I find these ID's?

#1831837

My issue is resolved now. Thank you!

#1835639
querie.png

Hi Shane, one more thing I see...

What if event has an StartDate and an EndDate .. We just passed the StartDate but the EndDate is in December. I have to add a second filter but what I tried It doesn't work.

hidden link

So thereis one event starting on 30 October and ends on 30 December. But I can't see this event.