Skip Navigation

[Resolved] Multi-line Indented taxonomies

This support ticket is created 5 years 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 3 replies, has 2 voices.

Last updated by Luo Yang 5 years ago.

Assisted by: Luo Yang.

Author
Posts
#1423307
taxonomy.PNG

As part of a post template, I am trying to add a section to the top that gives a list of nested taxonomies. Each post belongs to a taxonomy that may have 2 to 5 parents. I am providing a screenshot of what I would like to achieve. Each line is a taxonomy that the post belongs to. At this point, I can use <br> as a separator, but that does not provide indentation. I can also but in

<br><span style="padding-right:5px"><span>

but that just indents lines 2 on and it does not nest the lines.

#1424293

Hello,

I assume we are talking about a Hierarchical taxonomy, and you are going to display the result like this:
- Grandparent term A
-- Parent term B
---- Post 1
---- Post 2
-- Parent term c
---- Post 3
---- Post 4

If it is, it is possible with nested view, for example:
1) Top level taxonomy view:
- Query terms of your custom taxonomy
- Filter by:
Select taxonomy terms whose parent is None.
- In view's loop, display below 2nd level taxonomy view

2) 2nd level taxonomy view
- Query terms of your custom taxonomy
- Filter by:
Select taxonomy terms whose parent is the value set by the parent view
- In view's loop, display below post view

3) 3rd level post view:
- Query posts
- Filter by:
Select posts with taxonomy:
your custom taxonomy set by the parent Taxonomy View
- In view's loop, display post information

More help:
https://toolset.com/documentation/user-guides/views/using-a-child-view-in-a-taxonomy-view-layout/
Views Inside Views – Display Nested Multidimensional Lists

#1425995

Does this method work under the new "Blocks?" I can't seem to find the referenced queries. I switched back to Views and worked with it. Here is the catch. I am using the view in a custom post type Template. So I only want to show the taxonomies associated with the displayed post.

Grandparent Taxonomy
Parent Taxonomy
etc.......

POST BODY

#1427211

The new "Block" editor does not support taxonomy view, so in your case, I suggest you try with legacy View interface, for example:
1) Top level taxonomy view:
- Query terms of your custom taxonomy
- Filter by:
a) Taxonomy is set by the page where this View is inserted
b) Select taxonomy terms whose parent is None.
- In view's loop, within shortcode <wpv-loop>...</wpv-loop> display below 2nd level taxonomy view

2) 2nd level taxonomy view
- Query terms of your custom taxonomy
- Filter by:
a) Taxonomy is set by the page where this View is inserted
b) Select taxonomy terms whose parent is the value set by the parent view.
- In view's loop, within shortcode <wpv-loop>...</wpv-loop> display below 2nd level taxonomy view's itself shortcode

3)in single post content of your custom post type, display:
- Shortcode of Top level taxonomy view
- Post body of current post