How to order a dropdown by display count ?

Forums › Forums › Search & Filter Pro › How to order a dropdown by display count ?

Viewing 7 posts – 1 through 7 (of 7 total)
  • Anonymous
    #79879

    Hello,

    Is there any way to order ( desc ) a dropdown by the display count ? Maybe a filter or something ?

    P.S : the plugin is awesome

    Trevor
    #79912
    Anonymous
    #79973

    Not 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
    #79992

    Ah, I see. I am afraid not, no.

    Trevor
    #79994

    Wait. Ross has reminded me that you can code this.

    Trevor
    #79998

    See 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.

    Anonymous
    #80008

    Cool. I will check that one out

Viewing 7 posts – 1 through 7 (of 7 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.