Home › Forums › Calendar Products › Filter Bar › Change the sequence of numbers
- This topic has 4 replies, 3 voices, and was last updated 7 years, 2 months ago by Florian.
-
AuthorPosts
-
February 7, 2017 at 1:47 am #1230412FlorianParticipant
What I’ve done:
– I created a new “additional field” “Alter” (= “age”) with numbers which can be selected in the backend
– I added the additional field to the filter-bar
What the filter-bar does:
The sequence of the numbers is not what I want:
What it Should be:
The numbers should be in this order:
-8
-9
-10
-11
– (…)Is it possible to change the order of the numbers?
February 7, 2017 at 1:51 pm #1230880NicoMemberHi there Florian,
Thanks for getting in touch with us! I can help you on this π
Can you please try the suggested solution in this previous reply β https://theeventscalendar.com/support/forums/topic/filterbar-checkbox-order/#dl_post-1099120 ?
You’ll need to change the field key for the correct one in the site. If you are not sure of what this value should be just sent me a URL where I can see the filter in action.
Hope that helps,
Best,
NicoFebruary 13, 2017 at 1:33 am #1233694FlorianParticipantThx Nico, it’s working now.
Steps I’ve done
1. I’ve put this code in the theme’s “functions.php”:
/* * The Events Calendar - Change filter values order */ add_filter( 'tribe_events_filter_values', 'tribe_re_order_filter_tags', 10, 2 ); function tribe_re_order_filter_tags ( $values , $slug ){ if ( $slug == '_ecp_custom_2' ) { sort($values); // a-z } return $values; }
2. To figure out what to fill in for “_ecp_custom_2” (field key):
Events >> Help >> @ Systeminformation I found the snippet:[10] => Array ( [name] => _ecp_custom_10 [label] => Alter [type] => checkbox [values] => 5
=> _ecp_custom_10 is the neccesary field key (in my case)
Just for (my) interest:
http://php.net/manual/en/array.sorting.php <– are these the options to sort the values of the custom field?
February 13, 2017 at 4:56 am #1233736NicoMemberThanks for following up Florian! Nice work checking the field id in the system information π
http://php.net/manual/en/array.sorting.php <β are these the options to sort the values of the custom field?
Yeah, those are all PHP functions that might help you ordering the values.
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 -
AuthorPosts
- The topic ‘Change the sequence of numbers’ is closed to new replies.