Skip Navigation

[Resolved] How can I display the parent taxonomy name on my wordpress archive by taxonomy?

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

Problem:

How can I display the taxonomy name on term archive page

Solution:

You can get the the archive page title with shortcode
[wpv-archive-title]

And you can displays information about the current taxonomy:
[wpv-taxonomy-archive]

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-archive

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

Last updated by Luo Yang 6 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#923791
Capture d’écran 2018-07-12 à 01.22.42.png

I have created hierarchical categories of posts, when I click on a parent category, I land on my wordpress taxonomy archive which lists all posts assigned to that parent category or to one of its child category. I would like the title of that page to always be the parent category.
I have added this shortcode to my view:
<div class="ms-cat">[wpv-post-taxonomy type="category" format="name"]</div>
But it displays the first taxonomy term which is concerned by aphabetical order, no matter if it is a parent or a child.
How can I solve this ? Can I adjust the slug with numbers to make sure that this comes first? Or can I insert some if statement in my view to display the parent category instead of the child category? I have also tried to use:

[wpv-post-taxonomy type="category" item="$parent"]

See enclosed screenshot: when I click on Lifestyle, the title of my page ends up being "Coup de coeur" because there is also one article of the sub category Coup de coeur and because C is before L in the alphabet.

But nothing gets displayed, hence I do not understand what this shortcode is supposed to do...

Please help.
Thanks and regards
Francine

#923934

Hello,

The shortcode [wpv-post-taxonomy] can only output the terms in alphabetical order, ASC or DESC, see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-taxonomy

But you can get the the archive page title with shortcode [wpv-archive-title], for example, in the archive page of term "Lifestyle", shortcode [wpv-archive-title] should be able to output the term's title: "Lifestyle"

#924352

Thank you, that helps already and indeed gives me the info I want.
Only problem is that it gives me the following result
categorie : Lifestyle
and I would like to have
Lifestyle
without the word category :
could I possibly use regex to remove the word category :
and only keep the category name itself?
or hide the string "category :" entirely?
If you have an idea, that would help
Thanks

#924361

I finally found the answer on a post of one of your customers.
I need to add the following shortcode:
[wpv-taxonomy-archive info="name"]

So all good for now.
Thanks

#924470

Thanks for sharing the solution.