Help Desk

Order of additional fields in filter

  • Posts: 8 Topics: 9
    | Permalink

    I cannot figure out how our additional fields are being ordered in the filter bar. It is not alphabetical and it is not the order they are listed in the additional fields. Is there a way to control the order?

    Posts: 6240 Topics: 17
    | Permalink

    Hello Lauren!

    Thanks for reaching out to us!

    Unfortunately, there is no direct way to adjust the order of custom fields in Filter Bar at the moment. It may very well be possible with some custom development, but I do not have a workaround that is supported by the plugin.

    There is an open ticket for this in our User Voice here: https://tribe.uservoice.com/forums/195723-feature-ideas/suggestions/13251324-control-the-order-of-items-inside-a-drop-dow-box-i

    I’d suggest you add your vote to it and if you’d like also leave a note about your use case. This way it can get into one of our future feature releases.

    I’m sorry for the news, but I hope this at least helps answer your question about the possibility of changing the order of filters.

    Let me know if you have any other questions and I’d be happy to help as much possible.

    Best,
    Victor

    Posts: 6240 Topics: 17
    | Permalink

    Hi Lauren!

    Just wanted to follow up with this to let you know that I was digging around the code a little deeper and I found a way to actually order the additional fields in the filter bar.

    You would have to place the following code snippet into your theme’s functions.php file to make that happen:

    /*
    * The Events Calendar - Change filter values order
    */
    add_filter( 'tribe_events_filter_values', 'tribe_re_order_filter_categories', 10, 2 );
    
    function tribe_re_order_filter_categories ( $values , $slug ){
    
    if ( $slug == '_ecp_custom_2' ) {
    sort($values); // a-z
    //rsort($values); // z-a
    }
    
    return $values;
    }
    

    Please give that a try and let me know if it works for you.

    Best,
    Victor

    Posts: 65
    | Permalink

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

    | Permalink