Skip Navigation

[Resolved] What shortcode do I use to filter my view by a custom taxonomy?

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

Last updated by KeithM7209 4 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#1556595

Tell us what you are trying to do?
I have created my own view, lets call it 'View A'. In this view, I am loading all of the posts in my custom post type 'Projects'. I also have a custom taxonomy (which is used in 'Projects', called 'Sectors').
What I am trying to do, is to load up my view 'View A' in the same page 4 times, but each one displaying the 4 different 'sector' values which I have input into my 'Projects' posts.
I cannot understand how to do this, I have read your documentation over and over again, but nothing I do seems to work.
Here is an example shortcode I am using to try and achieve what I want:

[wpv-view name="View A" sector="Sector A"]
[wpv-view name="View A" sector="Sector B"]
[wpv-view name="View A" sector="Sector C"]
[wpv-view name="View A" sector="Sector D"]

But all that seems to happen, is that it loads up ALL 'Projects' posts each time (ie, they are not being filtered down by sector, it is just displaying all posts).

I cannot work out what I am doing wrong and I am pulling my hair out now, it's driving me crazy. Please can someone help me?

Thank you so much,

Keith

Is there any documentation that you are following? I've tried all sorts of different pages on your documentation. Although it is very detailed, it seems to lack examples of how to input shortcodes using custom taxonomy 🙁

Is there a similar example that we can see?

What is the link to your site?

hidden link

you will see, I am trying to load up Projects into a slider, and show different sliders for each 'sector'. But all of the sliders show ALL Projects posts. Thanks for your help 🙂

#1556981

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Basically, you want to filter your view by passing the shortcode attribute. Here is the doc:
=> https://toolset.com/documentation/user-guides/views/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes

You need to add a taxonomy filter form the Query Filter section of your view. Once you add taxonomy filter - you should chose the option "Value set by View shortcode attribute" and set the value to input box as sector which is your shortcode attribute name.

More info:
https://toolset.com/documentation/user-guides/views/filtering-views-by-taxonomy/

And with your view - you should pass the taxonomy term slug.

[wpv-view name="View A" sector="sector-a"]
[wpv-view name="View A" sector="sector-b"]

I hope the above information I shared will help you to resolve your issue.

#1557213

I could kiss you! thank you for the clear explanation, it is now working as I wanted 🙂