Sauter la navigation

[Résolu] Primary category on taxonomy shortcode

This support ticket is created Il y a 10 mois. 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Minesh Il y a 10 mois.

Assisté par: Minesh.

Auteur
Publications
#2689581

Hello,

I would like only show primary category in :
[wpv-post-taxonomy type="category" format="name"]

It's possible ?

Thank you

#2689587

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As you can see with the reference doc for the shortcode: [wpv-post-taxonomy type="category" format="name"]
=> https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153472

I'm afraid that you can't customize the output of the [wpv-post-taxonomy] shortcode as there is no option to display only parent terms.

The workaround should be you follow is:
- You could use a taxonomy View - To add a taxonomy view - you will have to enable the classic view:
=> https://toolset.com/course-lesson/enabling-legacy-version-of-toolset-views/#enabling-legacy-views

- Add a taxonomy view and set this view's source of content as your desired taxonomy
- Add a taxonomy parent filter where parent is "None", which will return only the top-level terms from "Query Filter" section.
- Then add a taxonomy term filter "set by the current post" from the "Query Filter" section - which will get the terms from the current post in the loop.
- In the View's "Loop Editor" section add whatever content you want to display and save your view and add your view instead of using [wpv-post-taxonomy type="category" format="name"].