Order of Search Options dropdown

Forums › Forums › Search & Filter Pro › Order of Search Options dropdown

Viewing 2 posts – 1 through 2 (of 2 total)
  • Anonymous
    #262976

    Hi,

    Is it possible to custom order the way search options appear in a dropdown, at the moment the options are in alphabetical order as follows:

    <ul class=”chosen-results”>
    <li class=”active-result sf-level-0 sf-item-0 sf-option-active” data-option-array-index=”0″>Date
    <li class=”active-result sf-level-0″ data-option-array-index=”1″>All Week  (2)
    <li class=”active-result sf-level-0″ data-option-array-index=”2″>Fri 13th November  (3)
    <li class=”active-result sf-level-0″ data-option-array-index=”3″>Mon 9th November  (4)
    <li class=”active-result sf-level-0 ” data-option-array-index=”4″>Sun 8th November  (14)
    <li class=”active-result sf-level-0 ” data-option-array-index=”5″>Thurs 12th November  (6)
    <li class=”active-result result-selected sf-level-0″ data-option-array-index=”6″>Tues 10th November  (4)
    <li class=”active-result sf-level-0 ” data-option-array-index=”7″>Wed 11th November  (5)

    But my client would like it in chronological order:

    <ul class=”chosen-results”>
    <li class=”active-result sf-level-0 sf-item-0 sf-option-active” data-option-array-index=”0″>Date
    <li class=”active-result sf-level-0″ data-option-array-index=”1″>Mon 9th November  (4)
    <li class=”active-result sf-level-0″ data-option-array-index=”2″>Tues 10th November  (4)(3)
    <li class=”active-result sf-level-0″ data-option-array-index=”3″>Wed 11th November  (5)
    <li class=”active-result sf-level-0 ” data-option-array-index=”4″>Thurs 12th November  (6)
    <li class=”active-result sf-level-0 ” data-option-array-index=”5″>Fri 13th November  (3)
    <li class=”active-result result-selected sf-level-0″ data-option-array-index=”6″>Sun 8th November  (14)
    <li class=”active-result sf-level-0 ” data-option-array-index=”7″>All Week  (2)

    Is this possible to do? Thank you.

    Regards.

    Trevor
    #262980

    If it is a Post Meta field, then you can set the source to Manual and drag and drop them. If it is a Taxonomy, then you will need to code a solution. You can use this filter in your child theme’s functions.php file:

    https://searchandfilter.com/documentation/action-filter-reference/#filter-input-object

    To re-order the terms in the field.

    I am not sure if it will help, but if there are many snippets already in the forum, this forum search should find them:

    https://support.searchandfilter.com/forums/search/sf_input_object_pre+function+order/

Viewing 2 posts – 1 through 2 (of 2 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.