Posted: March 19, 2024 at 10:33 am
Is there a filter for excluding events from the side bar widget? Currently I have a sidebar widget on our homepage displaying all events. I recently created a category “private” I was successful in removing them from main events list using CSS but the widget doesn’t seem to have any selectors to use that same method. Any idea with this. I’ve read through the forum but it’s not making much sense to me. |
|
Hi There, It seems you are using the upcoming events widget on the website. We recommend to check this ticket to remove a particular category from the sidebar: https://eventespresso.com/topic/exclude-event-categories-from-upcoming-events-widget/ Hope that helps. |
|
Hmm. Is there a filter example that works that I can just put in the category name or ID? More of an end user here trying to piece this all together. That thread is a bit confusing and the model made me even more confused. Thanks, any help appreciated. |
|
TRying this but stull not excluding:
|
|
I think I figured out part of it but still a bit unclear. I have a file called Upcoming_Events.php that seems to override the widget so I have made edits to that with the following code, where I am excluding category ID 95 “private” but I am still having an issue where if an event has no category assigned to it, it also wont show. I tried writing some more logic but just keep breaking the site. Any ideas? Otherwise this will do and I’ll just make sure we always have an event inside a category.. another way to solve this is to force a default category. hmm..
|
|
You don’t need to override the default Widget for this, you can get the same effect with the filter using:
This is the same issue I’ve been looking into before replying to this. I think without the ability to run a tax_query (which you can’t do through the model system) then this is as good as it’s going to get. However…. if using this method you always need to have a category assigned to the event right? So in that case what about using a ‘public’ category and selecting tha from within the widget. That removes the need for custom code here and just displays all of the events in that public category by explicitly selecting it in the widet settings. |
|
The support post ‘Exclude category from sidebar widget filter’ 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.