I'm trying to return a list of categories with the main category on top and the children underneath it. Then the next category under that the same way.
Is there any documentation that you are following? I've been all over support here trying to figure it out for hours. I try not to put in support tickets. 🙂
Side note: I'd like to be able to use the camera brands categories under the lenses section the same way. Do lenses have to be their own post type with their own categories for me to achieve this as well?
Thanks for any help and as always, you all rock! <3
Hi,
Thank you for contacting us and I'd be happy to assist.
To generate a hierarchal list of taxonomy items, you'll need two taxonomy views:
1. The parent taxonomy view will show only the top-level items, with the query filter to show only the terms without any 'parent'.
2. The child taxonomy view will be nested inside the loop of the parent one, with the query filter to show only the 'terms where the parent is the item from the current loop'.
Here is a general guide on how nesting of views works:
https://toolset.com/documentation/legacy-features/views-plugin/using-a-child-view-in-a-taxonomy-view-layout/
If you'd like to avoid using duplicated brand taxonomy terms, you can adopt the following structure:
1. The website will have one custom post type 'Products'.
2. This post type will be attached to two custom taxonomies:
a). Brands
Example terms: Canon, Nikon, Olympus,...
b). Product Types
Example terms: Cameras, Lenses, Tripods, E-Books,...
I hope this helps and please let me know if you need further assistance.
regards,
Waqar
Hey there, Waqar!
Ok, so here's what I did:
I deleted all the categories under Products.
I created the Brands and Product Types Taxonomies and populated the listings accordingly.
I attached those taxonomies to the Products CPT.
I created the Products Parent Taxonomy View and the Products Children Views.
I have tried my best for 3 hours (lol) to get it to work. I either get No items found or I get a repeating list of every brand there is all the way down the page under every product type.
Anyway you could log into it and have a look for me please?
Hey there, Waqar!
Is there a way to not show / reproduce the empty children that this loop is producing?
Thanks,
Jason
Hi Jason,
Thanks for the update and glad that you're making progress.
To suggest the next steps, I'll need to see exactly how these views are set up in the admin area. You can share temporary admin access details, in reply to this message.
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
regards,
Waqar
Thank you for sharing the access details.
In the current setup, the parent view ( 'Products List Parent' ) cycles through all the 'Product Types' terms, and the child view ( 'Products List Children' ) cycles through all the 'Brands' terms.
Since the terms in these two taxonomies are not actually linked together, these views have no way to restrict which of them are shown.
When I suggested the structure of using two separate taxonomies, the list of terms that I had in my mind would show two separate and independent lists without any nesting or hierarchy (through 2 separate views). One for the 'Product Types' terms and the other for the 'Brand' terms.
An alternate way of showing the term options in a more connected way would be to create a view that shows the 'Reviews' posts. That view can have the checkboxes type search filters for both these taxonomies and you can add that view on a separate page.
And in the pages where you'd like to show these terms in the sidebar, you can show this view's search form only. When the user would select an option in the search form, it will redirect to the newly created page where the view's search form and the results are both available.
This search form will be useful because, when a user will select a product type or a brand, the search form will update to show only those terms which can produce some results, which will naturally narrow down to only the relevant options.
I hope this helps and let me know if any point or step is not clear.
Hey there, Waqar!
That's a little complicated for (me) in what I'm trying to achieve. I remade it to work as intended and all is well.
Thanks again for all your help!
Jason
My issue is resolved now. Thank you!