Skip Navigation

[Resolved] shortcode to show only top taxonomy and only sub taxonomy

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

Last updated by Luo Yang 5 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#1172908

Tell us what you are trying to do?

[wpv-post-taxonomy type="location"] shows my top location and sub locations. I want one code to show only top location and another sub-location. I only have 2 levels of taxonomy. Please provide 2 separate shortcodes

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#1172913

Hello,

Please check our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-taxonomy
There isn't such an option within shortcode [wpv-post-taxonomy] to show only top location or only sub-location.

As a workaround, you can try with a nested view, for example:
1) Parent taxonomy view:
- Query terms of taxonomy "location"
- Filter by:
a) Taxonomy is set by the current post
b) Select taxonomy terms whose parent is None.
(It will be able to query all top level terms assigned by current post)
- in section "Loop Editor", display top level term's information + below child taxonomy view

2) Child taxonomy view:
- Query terms of taxonomy "location"
- Filter by:
a) Taxonomy is set by the current post
b) Select taxonomy terms whose parent is the value set by the parent view.
(It will be able to query all sub level terms assigned by current post)
- in section "Loop Editor", display top term's information

Then put the Parent taxonomy view's shortcode into a single post content, and test again