Skip Navigation

[Resolved] Primary category on taxonomy shortcode

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.

Our next available supporter will start replying to tickets in about 2.45 hours from now. Thank you for your understanding.

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)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 8 months ago.

Assisted by: Minesh.

Author
Posts
#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

Languages: English (English )

Timezone: 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"].