• Hi all.
    I am struggling a bit with a scenario. Not sure if this incredible plugin can do it or not.

    I have a list of custom post types (wines) with a series of custom fields (color, vintage, etc.). So for example:

    2020
    – Wine A
    – Wine B
    – Wine C

    2019
    – Wine D
    – Wine E

    2018
    (empty)

    2017
    – Wine F

    I would like to create a [loop] that replicates the list above, showing the list of ACF_wine-name ***for each unique ACF_vintage***.

    I can’t figure out how to programmatically go through every vintage and exclude the vintages with empty wine lists. The best I can do is manually define each vintage, but that clearly is not sustainable:

    <div class=”wine_list”>
    <p class=”vintage”>2020</p>
    [loop type=wines field=ACF_vintage value=2020]

    • [field ACF_wine-name]

    [/loop]
    </div>

    Any help would be greatly appreciated.

Viewing 1 replies (of 1 total)
  • 1. Loop through your “wines” content and get back the vintage value. Store them in a list variable.
    2. Pass that list with the vintage values to another loop to get your results.

    • This reply was modified 5 years, 3 months ago by polarracing.
Viewing 1 replies (of 1 total)

The topic ‘List of items for each *unique* ACF field value’ is closed to new replies.