Close filter bar with url parameter?

Home Forums Calendar Products Filter Bar Close filter bar with url parameter?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1267313
    Eric
    Participant

    I’d like to keep the filter bar expanded on my site by default – so I’ve set it to stay open in TEC settings. But in certain use cases I’d prefer it to be minimized.

    Is there a url parameter that can toggle that?

    #1269606
    Nico
    Member

    Hi there Eric,

    Thanks for getting in touch with us! I can help you here…

    Basically the state of the filter bar depends on the default setting, but if the user collapses or opens the filters that last stat is stored in a cookie and will be respected while the user navigates the calendar. I guess the options here are to change the cookie or trigger the show/collapse button via JavaScript on page load event.

    Do you think that might work for you? If that’s the case I can help you with a basic example of this.

    Best,
    Nico

    #1269643
    Eric
    Participant

    I think that could do the trick! Any examples (or pointing me to relevant areas) would be an immense help.

    Thanks a million!

    #1274308
    Nico
    Member

    Hey Eric,

    Sorry for the delay on my end! Try pasting the snippet below in your theme’s (or child theme’s) functions.php file:

    https://gist.github.com/niconerd/2b5cac81d3a936eb1c653ebb56395076

    Once the snippet is in place it will close the filterbar on page load if the hide_filters parameter is present in the URL (for example: http://sitename/events/?hide_filters=1).

    Hope this helps,
    Best,
    Nico

    #1279888
    Eric
    Participant

    That solves it perfectly! Thanks!!

    #1280150
    Nico
    Member

    Stoked to hear Eric 🙂

    I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.

    Best,
    Nico

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Close filter bar with url parameter?’ is closed to new replies.