Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

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

Viewing 7 posts - 1 through 7 (of 7 total)
  • Cristian Nebunu
    #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 Moderator
    #79912
    Cristian Nebunu
    #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 Moderator
    #79992

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

    Trevor Moderator
    #79994

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

    Trevor Moderator
    #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.

    Cristian Nebunu
    #80008

    Cool. I will check that one out

Viewing 7 posts - 1 through 7 (of 7 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.