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
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"
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
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
Thanks for sharing the solution.