Support

Home Forums Event Espresso Premium Shortcode To Filter by Status

Shortcode To Filter by Status

Posted: October 12, 2016 at 8:45 am


NYSCDFI

October 12, 2016 at 8:45 am

Is it possible to filter by category AND status? The category shortcode is working great but is shows both active and upcoming events but we only want to show upcoming (because active can no longer be registered for). Is this possible?


NYSCDFI

October 14, 2016 at 12:05 pm

Update:

I was given this suggestion:

Here is a sample code snippet that you can use in a site specific plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/):

https://github.com/eventespresso/ee-code-snippet-library/blob/master/templates/de_ee_filter_events_out_with_expired_tickets.php

It will remove expired events from the events listing view. This affects the default /events/ page along with the [ESPRESSO_EVENTS] shortcode.

However, I implemented this and I think the problem is that the list is showing both upcoming and active events. For us, events that are active can no longer be registered for and we therefore do not want them to show up in the list. Does anyone else have a suggestion on how we might be able to make this work properly?

Thanks so much!


Seth Shoultes

  • Support Staff

October 14, 2016 at 9:40 pm

Hi there,

I’ll need to ask one of our developers when they come back online Monday, if not over the weekend.


NYSCDFI

October 17, 2016 at 7:59 am

Thanks so much Seth! I really appreciate your help with this!


Josh

  • Support Staff

October 17, 2016 at 12:42 pm

Hi there,

The code snippet you linked to above (this one) actually filters out events where the tickets are no longer for sale. So if your active events have ticket sale end dates in the future, then the filter in that snippet will continue to show those events in the list.

So you can take one of these two approaches: a) You set the Ticket Sale end date to match or be before the date time start date or b) You add the following snippet to your site:
https://gist.github.com/joshfeck/646d496e72942b5251d484d522d762ee


NYSCDFI

October 18, 2016 at 7:24 am

Thanks Josh! I inserted the code (both yours as well as the previous suggestion) and it doesn’t seem to work. I had inserted the list onto a page using the category shortcode. Do I need to modify the function to apply to all lists, event the category lists?


Josh

  • Support Staff

October 18, 2016 at 9:31 am

There is no need to modify the function, it applies to all lists, even the category lists. If you added the code to a plugin, did you activate the plugin?


NYSCDFI

October 21, 2016 at 6:00 am

I cannot believe it was that simple. Thanks Josh and I am sorry that it was something on my end! That fixed it and I am so so so excited that we got this working.

THANK YOU!!

The support post ‘Shortcode To Filter by Status’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  NYSCDFI 2 years, 10 months ago ago

Topic Tags

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!