Events Made Easy › Forums › How do I … › URL Parameters
- This topic has 6 replies, 2 voices, and was last updated 5 years ago by Franky.
-
AuthorPosts
-
Mon 18 Nov 2019 at 11:31 #60535AnonymousInactive
Hi,
I was just wondering if it is possible to add a category number as a parameter on a URL, so when followed it automatically filters the events list based on that parameter?
Or is there another way this can be done?
I know I could just create the pages with the appropriate tags but I was just wondering if this is possible?
Thanks,
David.Mon 18 Nov 2019 at 11:43 #60536AnonymousInactiveI can set the parameter using ?eme_cat_filter=18 on the end of the URL but need to know how to effectively press the search button as well!
Mon 18 Nov 2019 at 19:41 #60537FrankyKeymasterAnd which search are you talking about? If you talk about the wordpress search, then read the FAQ about “How to add events to your wordpress search results?” at https://www.e-dynamics.be/wordpress/faq/
Tue 19 Nov 2019 at 09:51 #60538AnonymousInactiveSorry, i wasn’t clear.
I meant the filters on the [eme_events] page.
I’ve got the page https://learning.necsu.nhs.uk/upcoming-events/ listing all upcoming events in a table with a category & date drop down filter & search button.
I’d like to have a URL elsewhere on the site that links to this page but sets the category and filters it on load, without any other interaction. I can set the category no problem passing a parameter in the URL but the search button still needs to be hit.
I was just wondering if this was possible some way?
Thanks,
David.Tue 19 Nov 2019 at 10:15 #60539FrankyKeymasterIf you add eme_cat_filter to the url, [eme_events] automatically takes it into account.
Tue 19 Nov 2019 at 10:37 #60540AnonymousInactiveI’ve used the URL: https://learning.necsu.nhs.uk/upcoming-events/?eme_cat_filter=18 and it sets the filter in the drop down list but it doesn’t actually apply the filter, I still need to click the search button to apply the filter.
The link above should filter the events so they’re only Microsoft Office courses.
Tue 19 Nov 2019 at 12:28 #60541FrankyKeymasterIt does apply, see the difference between https://learning.necsu.nhs.uk/upcoming-events/ and https://learning.necsu.nhs.uk/upcoming-events/?eme_cat_filter=18
However: afterwards it is undetermined what would happen if you select another category. Reason: I’m using REQUEST[’eme_cat_filter’] which covers both GET and POST. But if you use the url the way you want to, it is a GET and when submitting the search it is a POST, and by default GET takes precedence in REQUEST (see also https://stackoverflow.com/questions/43157933/what-is-the-request-precedence).
Best would be that you create a button that does a POST to https://learning.necsu.nhs.uk/upcoming-events/ (there are plugins in wordpress that help you do that). -
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.