Customizing the filter bar

Home Forums Calendar Products Community Events Customizing the filter bar

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1071721
    bcitweb
    Participant

    We are running a two-day event with pro and the filter bar and would like to customize the presentation. Basically we need filters by category (which is part of filter bar) and then an additive filter for day of week, where the only selection is one of the two days over which our event runs.

    Now I can see that I can hack the source directly to change the days of the week filter and get basically close to what I want. Is there a right way to do this without hacking the source directly?

    • This topic was modified 10 years, 2 months ago by bcitweb.
    #1072120
    Nico
    Member

    Hey James,

    Thanks for reaching out to us on this! I’ll help you getting this done the right way ๐Ÿ™‚

    The correct way of doing this is to add a filter to tribe_events_filter_values and modify the filter values before they get printed. Add the following snippet to your theme’s functions.php file:


    /*
    * The Events Calendar - Change filter values
    */
    add_filter( 'tribe_events_filter_values', 'tribe_change_filter_values', 10, 2 );

    function tribe_change_filter_values ( $values , $slug ){

    if ( $slug == 'dayofweek' ) {
    // remove mondays
    unset($values[0]);
    // preview values
    //echo '

    ';
    		//print_r($values);
    		//echo '

    ';
    }

    return $values;
    }

    In the example above I’m removing Mondays as an example, I guess you’ll get how to customize the code!

    Please let me know if this works for you,
    Best,
    Nico

    #1072265
    bcitweb
    Participant

    Very nice. Thanks.

    #1072604
    Nico
    Member

    Stocked to hear James ๐Ÿ™‚

    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 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Customizing the filter bar’ is closed to new replies.