I need to only return unique results. Specifically, a taxonomy. I have a few results that are the same taxonomy and I don't need it to repeat.
I am currently using a View to filter posts. Those posts have a taxonomy on them. I want to return a list of taxonomies from all the posts just one time. So if two posts have the same taxonomy I only want that taxonomy to return once.
Is there any documentation that you are following?
Couldn't find any.
Is there a similar example that we can see?
Not really.
What is the link to your site?
Can be shared. But not necessary was the concept can be applied without the site.
Is it that you want to list out the first post of a taxonomy? So if Taxonomy A has 3 post and Taxonomy B and 4 posts, you only want to get 1 post from taxonomy A and only 1 from Taxonomy B?
So for Part A this will require you to create a Taxonomy view. This taxonomy view will list out your taxonomy term names and it will serve as the parent view for your child view with post.
For Part A, I need to filter the taxonomies that are showing. I think I wasn't totally clear.
My View is producing a list of posts and I'm filtering those by a custom field. If my taxonomy is a list of states then I want to take all the posts in my view and produce a list of all the states that are on those posts without showing duplicate states.
My View
Post 1 (Virginia)
Post 2 (Virginia)
Post 3 (Idaho)
Post 4 (Idaho)
Post 5 (Florida)
Taxonomy Results (Unique only)
Virginia
Idaho
Florida
Then my nested view would produce
Virginia
- Post 1
- Post 2
- Post 3
Idaho
- Post 4
- Post 5
Florida
- Post 6
...And so on.
Getting my filtered view to only show me unique taxonomy results is where I am stuck. It's showing me either all results or repeating results per post that my view found.
I believe I understand what you. So you first want your taxonomy view to list the taxonomy terms and under each unique term you list the appropriate post.
The taxonomy should only represent what is on the list. So it needs to be pulling from what the view loop is returning (but not on each item, it should be a separate list), or we need to have it use the state filter.
You can see in my example that the taxonomy is showing more than what is on the list.
Could be that I am going about this all wrong so I am open to ideas that achieve this.
I believe i understand this fully now. So you want your taxonomy view to filter based on the state that is selected.
Unfortunately that isn't possible and the view can only be filtered based on the current page that its on or the current post that is in the view loop.
So unless one of those 2 are met then it won't work.