How to write a single loop (not multiple loops) that prevents duplicate output.
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.
- The topic ‘How to write a single loop (not multiple loops) that prevents duplicate output.’ is closed to new replies.