How to write a single loop (not multiple loops) that prevents duplicate output. (2 posts)

  1. william.alexander
    Posted 3 years ago #

    I am using a loop to display custom field values in a navigation area. Example: I have 100 posts on the page. Each post has a Brand associated with it (Fender, Gibson, etc.) maybe about 15 brands overall. The navigation loop will output the Brand custom field value for the posts. I want it to only show a brand once, so that instead of outputting 100 Brand values, the loop only outputs 15 unique values, with no duplicates. Everything google shows me about preventing duplicates has to do with wanting a second loop not to duplicate anything from the first loop. This is not my issue - I simply want to prevent duplicate output in a single loop. Any advice? Thank you.

  2. vtxyzzy
    Posted 3 years ago #

    It is very difficult to help with this problem without being able to see the actual code used. If you put the code in a pastebin and post a link to it here, someone might be able to help.

Topic Closed

This topic has been closed to new replies.

About this Topic