Skip Navigation

[Resolved] How to display a hierarchical taxonomy’s parent title (not as an integer)?

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to display the parent taxonomy term name on the child term's archive page.

Solution: There's not a way to do this with shortcodes alone, so you'll need to use Views or you can write your own custom code. The Views approach is described below.
- Create a new View of your taxonomy, filtered by taxonomy term ID, where the term ID is provided by a shortcode attribute "ids".
- In the Loop Output editor, place the taxonomy title shortcode or the taxonomy link shortcode - this will be used to display the parent term so format it however you would like.
- Place this View inside your taxonomy WordPress Archive's Loop Output editor, outside of the wpv-loop tags, but inside the wpv-items-found tag.
- Add the "ids" shortcode attribute to the View's shortcode, and use the wpv-taxonomy-archive tag to supply the value of the parent term ID:

[wpv-view name="your-view-slug" ids="[wpv-taxonomy-archive info='parent']"]

So you're accessing the parent term ID with the wpv-taxonomy-archive tag, and using that value to define the filter for another View. This is called passing arguments into a View.

Relevant Documentation: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by BD 6 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#599981

BD

I would like to display the parent taxonomy title on a taxonomy page.
I have created a custom hierarchical taxonomy and I would like to display the immediate (not top level) parent taxonomy title next to the current taxonomy title.

I have looked at:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-archive

I am using [wpv-taxonomy-archive info="name"] to get the current taxonomy title.
I have tried [wpv-taxonomy-archive info="parent"] to get the parent title but it only returns an integer. I would like the title, not an integer to be displayed.

Can you help please? Thanks as always,

Nick

#600263

There's not a way to do this with shortcodes alone, so you'll need to use Views or you can write your own custom code. The Views approach is described below.
- Create a new View of your taxonomy, filtered by taxonomy term ID, where the term ID is provided by a shortcode attribute "ids".
- In the Loop Output editor, place the taxonomy title shortcode or the taxonomy link shortcode - this will be used to display the parent term so format it however you would like.
- Place this View inside your taxonomy WordPress Archive's Loop Output editor, outside of the wpv-loop tags, but inside the wpv-items-found tag.
- Add the "ids" shortcode attribute to the View's shortcode, and use the wpv-taxonomy-archive tag to supply the value of the parent term ID:

[wpv-view name="your-view-slug" ids="[wpv-taxonomy-archive info='parent']"]

So you're accessing the parent term ID with the wpv-taxonomy-archive tag, and using that value to define the filter for another View. This is called passing arguments into a View, and we have more information about this process here:
https://toolset.com/documentation/user-guides/passing-arguments-to-views/

#600431

BD

Thanks Christian - that's very helpful. Nick

The forum ‘Types Community Support’ is closed to new topics and replies.