Forums › Forums › Search & Filter Pro › Order of Search Options dropdown
Tagged: ORDER, search options
- This topic has 1 reply, 2 voices, and was last updated 4 years ago by Trevor.
-
Anonymous(Private) October 15, 2020 at 10:41 am #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(Private) October 15, 2020 at 11:38 am #262980If 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/
-
AuthorPosts