Skip Navigation

[Resolved] Passing multiple values as shortcode attributes

This support ticket is created 4 years, 2 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by Pete 4 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#1762375

These pages uses shortcodes: hidden link

Like this: [wpv-form-view name="holidays-sub-feat-pages" wpv-area="devon" wpv-collection="dog-friendly" target_id="self"]

[wpv-view name="holidays-sub-feat-pages" wpv-area="devon" wpv-collection="dog-friendly" view_display="layout"]

Is there a way of using these to use tow taxonomies in the same collection? Note the same wpv-collection code.

This works well when using taxonomies from two different collections like wpv-area and wpv-collection

Worth an ask 🙂

#1762391
#1762549

Hi Pete,

Thank you for waiting.

During testing on my website, I was able to make this work, by passing multiple taxonomy term slugs in a shortcode attribute, separated by commas.

For example:


[wpv-view name="holidays-sub-feat-pages" wpv-collection="just-fro-two, dog-friendly"]

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1762613

Hi Waqar<

Hmmm interesting. I did try all kinds of variations with commas and different things.

On this page: hidden link

I have used this code:
For the filter: [wpv-form-view name="holidays-sub-feat-pages" wpv-collection="close-to-coast, dog-friendly" target_id="self"]

For the grid: [wpv-view name="holidays-sub-feat-pages" wpv-collection="close-to-coast, dog-friendly" view_display="layout"]

Hate to say, it's bringing up results that are not 'close to coast'.

I'm unsure if your variation was one I tried initially however your code bringing things that are not in ;close to coast' collection.

#1763113

Hi Pete,

If you'll check the "Collection" taxonomy's query filter in the view "Holidays Sub Feat Pages", you'll see that the "any of the values" option is selected.
( screenshot: hidden link )

This means that the view will get all the results, where either "close-to-coast" or "dog-friendly" terms are available.

If you'd like to get the results where all the passed terms should be available, the you'll need to change "any of the values" option to "all of the values".

regards,
Waqar

#1763183

Hey Waqar,

You're a 'star', yep that sorted it...this works perfectly which I never thought it would 🙂

Can I ask, I duplicated the View in question, and on the replicated 'new' View made the adjustment to query filter.

If I had made this change to the existing View "Holidays Sub Feat Pages" would it have busted all the other Views set to the original settings?

Essentially, am I better having a separate View for this setup? 🙂 Thank you again 🙂

#1763197

Hi Pete,

Thanks for the update and glad that this is sorted out.

Yes, if in all other pages, you need "any" of the terms comparison and only in specific page(s), you need "all" terms comparison, then duplicating the view is the right way to go. This way you'll have a view for each case.

regards,
Waqar

#1763199

My issue is resolved now. Thank you!