Alphabetize Additional Fields in Filter

Home Forums Calendar Products Filter Bar Alphabetize Additional Fields in Filter

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1327027
    Joelle
    Participant

    Hello, I’ve read the recent threads on this topic and tried this solution provided, but there is zero change.

    /*
    * 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 == 'instructor' ) {
    sort($values); // a-z
    //rsort($values); // z-a
    }
    
    return $values;
    }

    We are running WordPress 4.8, The Events Calendar Version 4.5.9, PRO Version 4.4.15 and Filter Bar Version 4.4.3. YES, I have deactivated all the plugs and themes and did that whole dance. 🙂

    Any ideas?

    ========================
    PLEASE LEAVE FOR SUPPORT
    Reporting the same issue as: https://theeventscalendar.com/support/forums/topic/order-of-additional-fields-in-filter/

    #1327533
    Joelle
    Participant

    Hiya! Checking in on this, as well. Thank you!

    #1327792
    Cliff
    Member

    Hi, Joelle. Sorry for the delayed reply here.

    That code looks like it’s on the right track, but what is “instructor”?

    Also, is sort() really what you want? If yes, you might want to try adding the SORT_NATURAL flag or do some other type of sorting just to check if your code is actually taking effect.

    Please let me know what you find out.

    #1328414
    Joelle
    Participant

    ‘instructor’ is the slug for the drop-down that I want alphabetized. If that’s not correct, let me know.

    But I tried it with your default code and that didn’t work either, so maybe I’m not doing it correctly.

    This list (attached) needs to be alphabetized. We have done so in the backend, in the Additional Fields area, they are alphabetized in our list of options for that dropdown, but on the front end, it shows however it wants.

    How can this be fixed?

    #1328416
    Joelle
    Participant

    I forgot to attach the image, sorry.

    #1328424
    Joelle
    Participant

    A HA! I figured it out. Oopsie, my bad. I needed to put _ecp_custom_4. I had the field slug wrong, so no wonder your default, nor my attempt worked. All is well on this one. Thank you!

    #1328590
    Cliff
    Member

    Great find! Thanks for letting us know.

    FYI: Images don’t come through from email replies. Please keep this in mind for future threads.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Alphabetize Additional Fields in Filter’ is closed to new replies.