Forums › Forums › Search & Filter Pro › How to order a dropdown by display count ?
- This topic has 6 replies, 2 voices, and was last updated 7 years, 10 months ago by Anonymous.
-
Trevor(Private) January 4, 2017 at 1:42 pm #79912
Is this what you mean?
https://support.searchandfilter.com/forums/topic/sorting-by-popularity-2/
Anonymous(Private) January 4, 2017 at 5:02 pm #79973Not really. I have a dropdown that pull labels ( acf field ) from custom post types. The labels have next to them the number of posts. For instance, the are 5 posts with the label Ampex, so in the dropdown I see Ampex (5).
The options for this item in the backend are to order DESC or ASC alphabetically or by number, but since my options are names, alphabetical it is.
Now I was wondering if I can order them by the number of posts (or the display count, as it is called in the plugin).
Trevor(Private) January 4, 2017 at 5:55 pm #79998See here in the documentation.
If you use the filter
sf_input_object_pre
you get access to the options as an array, so you can order this array however you want.You Do have access to the count variable, so you can use this to sort the array with php. But you would need to code this.
-
AuthorPosts