Home Forums General Issues Displaying grouped content Reply To: Displaying grouped content

  • This isn’t something that ACF will do automatically, you’ll need to handle this with your query and loop.

    WP 4.0 and 4.2 introduced better ordering.

    For the latest change, see this post:

    As for the enhanced orderby see the orderby section codex page for WP_Query or this post:

    First you need to get them ordered correctly. This will output them in the right order, then you can create a custom loop that will do the work.

    Here is an example of a simple loop that will do the separating.

    $last_brand = '';
    $this_brand = '';
    while (have_poste()) {
        $this_brand = get_field('brand');
        if ($this_brand != $last_brand) {
            // change brands
        $last_brand = $this_brand;
        // rest of the loop here