Apologies if I'm asking a question that's covered by your documentation. I feel like this is something I should be able to do but so far I'm failing!
I would like to create a view which lists all the taxonomy terms for a particular CPT. This is what I've done:
1. Created a view
2. Set it to Taxonomy for Content Selection
3. Added the taxonomy title and other details to the loop output
It is showing the details in the view, but because the active term has two items added to it it's actually listing it twice. I'm sure I'm doing something stupid!
Can you point me in the right direction please?
Cheers, Emily
When people talk of taxonomy queries it is always a source of potential confusion.
You can query POSTS according to their assigned taxonomy terms.
Or you can query a taxonomy to display terms entirely independently of the posts to which they may or may not be assigned.
So you might create a View which queries a country taxonomy to list all the countries as links to their taxonomy archives (which would display the posts with that country assigned).
Now, you have created a View to display taxonomy terms. You have a few options which affect which terms are included (e.g. whether to include empty terms, i.e. not assigned to any posts), but the terms returned are otherwise independent of the connected posts.
The Loop Output section is going to iterate over those terms, so you can output the title of the term, or a link to its archive, etc.
You lost me at "but because the active term has two items added to it it's actually listing it twice".
Thanks for your reply. I think this is what I'm trying to do:
"Or you can query a taxonomy to display terms entirely independently of the posts to which they may or may not be assigned."
So, a list of the taxonomy terms, linking to the taxonomy archive for that term.
So, this is what I've got so far:
- A view which is set to Content Selection: Taxonomy
- The Taxonomy selected
- No queries set
- Then in the loop I've created a list with the taxonomy title and link
This is what I'm getting: hidden link
Each term is showing several times, but it should just have Pico and Pendeen once. Which I'm sure is because I haven't set it up right!
Are you able to point me to a tutorial for setting a view to display the terms, or maybe talk me through it?
What you describe sounds right, but clearly something is amiss.
Maybe the quickest thing would be if I could take a look at your View and check the data.
Let me mark your next reply as private. You may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site, though I don't intend to make any changes, I'll just be looking.
Perhaps you can explain what you are trying to achieve.
The page you linked to is an archive, that displays Pebble Seat Clients POSTs.
In the loop output section of that archive—which will iterate over all such posts—you have inserted the View "Pebble Seat Product View" which displays the taxonomy terms of the Pebble Seat Products taxonomy.
Because you have inserted this View inside the loop output section of the archive it is repeated for every post in the archive.
Obviously not what you want, but, what do you want?
Ah, my problem is that I'd inserted it in the loop. I knew I was doing something stupid! I thought it was how I had created the view, but it's actually where I had inserted it that was causing the problem.