• Hi there,

    My client has a website listing different sailing services. These services have different levels of subscription:

    – Free
    – Premium
    – Full

    In the back end, I have set up some Custom Fields using Advanced Custom Fields (which work perfectly as normal WP custom fields). The Custom Field for that service is called “subscription_level” and it’s a dropdown list with the options mentioned above.

    What I’m trying to achieve is to display the posts in the order of the level of subscription and alphabetically. So first, you’d have all the “Full” services sorted by title, then the “Premium” and then the “Free” ones.

    Like:

    —- Full —
    Full Service A
    Full Service B
    Full Service C

    —- Premium —
    Premium Service A
    Premium Service B
    Premium Service C

    —- Free —
    Free Service A
    Free Service B
    Free Service C

    Ideally this should also have pagination, but if that’s not possible, it’s not the end of the world.

    I have tried several custom select queries by looking at the Codex instructions, without luck. My problem is I need two ways of “orderby”? One that divides the posts according to the meta_value of a my custom field “subscription_level” and at the same time one that orders each level of subscription by title… and I just can’t seem to find a way of achieving this.

    Any ideas pointing me in the right direction would be awesome!

    Thanks in advance

  • The topic ‘Sort posts depending on value of Custom Field’ is closed to new replies.