|
How to display a hierarchical taxonomy’s parent title (not as an integer)?
Started by: BD
in: Types Community Support
Quick solution available
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/
|
|
2 |
3 |
6 years, 11 months ago
BD
|