Support

Account

Home Forums General Issues Alphabetical Query Posts via ACF Field?

Helping

Alphabetical Query Posts via ACF Field?

  • Is it possible to query a lists of custom post types via a ACF field’s first letter?

    E.g You have a acf called ‘organisation’ the users put in the organisation name, then front end the lists of posts are put in the order based on the fist letter of that organisation acf, basically alphabetical order of ‘organisation’ and also listed with the letter as well..

    A (organisations starting with a)
    Post Name
    Post Name
    B (organisations starting with b)
    Post Name
    Post Name

    etc
    etc
    etc

  • Hi @jez

    I think what you are looking for is to be able to sort posts using the custom field name as it would translate to sorting by the first letter.

    Here is an article that may help you with that.

    https://www.advancedcustomfields.com/resources/orde-posts-by-custom-fields/

    In order to group them by first letter, you would have to store them in a multidimensional array then use custom control structures to note the change in the start letter.

    I hope this helps.

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

The topic ‘Alphabetical Query Posts via ACF Field?’ is closed to new replies.