Skip Navigation

[Resolved] Display sub-category on top level, display posts on lowest level

This support ticket is created 7 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by thomasS-11 7 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#436049

I have tried following EVERY support thred about this in the support forum, and nothing seems to work. I am giving this a last try .

Hello guys.

I have created my own Post Type "Products".
This has categories "Product Categories", that has 2 levels.

Level 1:
Clothes
-Level 2:
-Pants
-Shirts
-Etc, etc..

I am trying to:
If you click "Clothes" - it will show PANTS, SHIRTS etc.
If i click "Pants" - it will show the PRODUCT posts inside the Pants Sub-category.

I have (seriously) tried almost EVERY combination of the filters, and nothing works!

Currently i have a 3-level View setup
A view that displays Taxonomy Categories from "Product Categories" (Top level)
Filter: No parrent

A view that displays the taxonomy term titles (Sub-categories).
Filter: Taxonomy set by the parent view

A view that displays the posts Product.
Filter: Taxonomy set by the parent view

I added this to Archive (set to the Taxonomy Archive), and it doesnt work as expected.
I tried disabling Archive and adding it as a Content Template - Didnt work either.

Please help me fix this, i am about to go crazy because of this.

If you are going to put examples, please be as clear as possible and format your text so it is readable.

Thank you.

#436362

Dear thomas,

I can see you have created three views, all of them are normal views, but the normal view won't work as expected in the archive page.

In your case, I suggest you create a wordpress page, and put the top level view in the page, use this page to replace the archive page.

#436385

But i need an Archive..
If a visitor visits a Taxonomy term, he won't get a Page - he will get a Archive, thats why i need to do this in Archive / Content Template for the Taxonomy.

The only way i can see this happen, is if i can evaluate that current term has a parent.
That way, i can make a Content Template for the Taxonomy, and validate.

If it has children - show view with Children. If no children, show the view with Posts.

Can you please help me evaluate if there is any children in current term, in a Content Template page?

#436426

To customize the archive page, please follow our document to setup the wordpress archive:
https://toolset.com/documentation/user-guides/normal-vs-archive-views/

For the question:
If it has children - show view with Children. If no children, show the view with Posts.
You can try this, create a view list "Children" posts, filter with:
Select posts that are a children of the current post in the loop.
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/
in section "Loop Output Editor",
1) in the shortcode [wpv-items-found]...[/wpv-items-found]:
If it has children - show view with Children
2) [wpv-no-items-found]...[/wpv-no-items-found]
If no children, show the view with Posts.

#436777

Hi Luo

I know how to work with Archives and Views (and everything else in these plugins), i was using WP-Types since version 1 and same with Views.

What my problem is, is i need to be able to evaluate if CURRENT TAXONOMY TERM has any TERM children, not POSTS. (i capslock to try and make the difference more clear).

I can achieve my desired result, if i could evaluate the above condition.

[wpv-items-found] - how did you expect this to solve my issue? This only checks if items was found..

#437503

Sorry for the misunderstand,
You can try this:
1) Create a view list terms of taxonomy "Product Categories", filter with:
Taxonomy parent filter
Select taxonomy terms whose parent is the current taxonomy archive.
see screenshot 1011.jpg

2) in section "Loop Output Editor",
1) in the shortcode [wpv-items-found]...[/wpv-items-found]:
If it has children - show view with Children
2) [wpv-no-items-found]...[/wpv-no-items-found]
If no children, show the view with Posts.

3) Then put above view into the wordpress archive for taxonomy "Product Categories"

For the question:
[wpv-items-found] - how did you expect this to solve my issue? This only checks if items was found

Yes, it should be able to solve your issue, that means Views can find the child terms.
https://toolset.com/documentation/views-shortcodes/#wpv-items-found
Meta HTML wrapped in [wpv-items-found][/wpv-items-found] will be output if there are any posts | taxonomies | users returned by the View.

#437535

Absolutely PERFECT Luo - Thank you very much for helping me achieve exactly what i want.
No workarounds, no hotfix. This is the kind of support i like!

You are so smart!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.