Skip Navigation

[Resolved] How can I add specific taxonomy in shortcode?

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

Last updated by Minesh 5 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1279609

I created post view by not select fillter category.
and I need to put category name in my shortcode something like : [wpv-view name="mypost" category="catename" limit="3"]
It's possitble to do that?

Or if i create Archive template , it's possible to use as shortcode with category's name?

#1279611

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I need to put category name in my shortcode something like : [wpv-view name="mypost" category="catename" limit="3"]
It's possitble to do that?
==> Yes - you can filter the view by shortcode attribute.

You should add the taxonomy filter to view form the "Query Filter" section you should add the taxonomy filter to filter by shortcode attribute:
=> https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

More info:
=> https://toolset.com/documentation/user-guides/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes

#1279895

Yes I know how to use Query Filter.
and that's made me has a lot of views template in my list and that's make my site too heavy and too slow.

I think it's better if I create only one views template and put the name of category in between shortcode.
( I have to put views template to many place in my site)

#1280617

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes, but when you pass view's shortcode attribute you need to filter your view by shortcode attribute.

For example:

[wpv-view name="view-slug" category="catename" limit="3"]

You are passing category as shortcode attribute now, when you add taxonomy query filter from Query filter, you need to chose the option Filter by Shortcode attribute and add category there.

So, you can use the same view to filter with multiple categories, for example:

[wpv-view name="view-slug" category="catename-one" limit="3"]
[wpv-view name="view-slug" category="catename-two" limit="3"]'
[wpv-view name="view-slug" category="catename-three" limit="3"]