0

We have an event listings page that contains a filter to select from a range of event categories and I want to see if it's possible to provide a url that, when visited, will have automatically applied the filter?

For example, our events page is site.com/events/ when on there you click the dropdown and select one of the eight event categories is there a way to append the url to something like site.com/events/category1 so it is already filtered for that category? I've tried adding the category url title, category id etc... but still just gives me an unfiltered event list.

UPDATE As an example, we have various categories of news items that produces the url site.com/news/c/category_name so I would assume that I could produce the same for events using site.com/events/c/category_name however this doesn't filter them and just shows me all events, I've tried using category_URl and category_ID but none of these work.

0

Are you creating your list of available categories using the channel:categories tag? If so, just use the{path} variables to create the links and the URLs will be built correctly to apply the selected category filter to your channel:entries tag.

<a href="{path="events/index"}">{category_name}</a>

Depending on your setup, this will output:

http://site.com/events/C1

or:

http://site.com/events/category/category1

(The category trigger is customizable, so it could vary. See the Category URL Segment and Category URL settings.)

| improve this answer | |
  • Categories are added through Channel Administration > Categories > Events > Add/Edit Categories, the events index page uses <select id="bEvents" name="bEvents"> {exp:b_categories:options_parents parent="6" default="bEvents" show_kids="TRUE"} </select> in the filter to select one of the Event categories and displays them using {exp:channel:entries channel="events" entry_id="{exp:b_categories:do_event_search}17{/exp:b_categories:do_event_search}" orderby="event_start" sort="asc" dynamic="no" parse="inward"} – Trevor Clissold Jun 2 '16 at 8:54
  • I've added an example above regarding our news section, this doesn't work for events for some reason and I can't see where to edit the path criteria – Trevor Clissold Jun 2 '16 at 9:50
  • You're definitely using a custom add-on to manage your events list, as I have never heard of - nor can I find any reference online to - an add-on called b_categories. You'd have to speak with the original developer of the site to find out exactly why they chose to implement a custom add-on rather than using EE's native category filtering. – Derek Hogue Jun 2 '16 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.