Skip Navigation

[Resolved] Need Help Passing Multiple Arguments in a Single URL Parameter

This support ticket is created 3 years, 5 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/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by zacharyL 3 years, 5 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#1310727

I'm trying to pass multiple taxonomy term arguments through a single URL parameter, and I'm not sure of the syntax that's needed to accomplish this.

I have a link within single product page layout that is intended to link to a page with a view that is needed to be filtered by the taxonomy terms that are related to the particular product. I just need help setting up the href structure.

This is what I have so far:

href="/finish-gallery?finish-style=[wpv-taxonomy-id]"

Right now, it supports a single taxonomy term id, but I want to create a view that lists out all the taxonomy term ids that are tied to a product.

#1310807

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

You can setup the link as below:

href="/finish-gallery/?finish-style[]={!{wpv-post-taxonomy type='category' format='slug' separator='&finish-style%5B%5D='}!}"

Notice, "%5B%5D" in above codes are URL encoded of characters: []

It will be able to pass term's slug to target page "finish-gallery", in the post view of target page, you can setup a post view filter by the taxonomy slug, for example:
finish-style slug in one of those set by the URL parameter finish-style
eg. hidden link

More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-taxonomy
separator (opt):
'string separator for multiple values'
Default value is comma followed by a space

#1311565
screenshot.jpg

For whatever reason, the taxonomy term filter, set by URL parameter, only lets me use IDs, and the "format" attribute, for the [wpv-post-taxonomy] shortcode, doesn't support "id" as a value. But you did answer my question, in that I needed the correct syntax in which to push multiple arguments through to my views' filters via a URL parameter.

My markup still involves the taxonomy view which outputs the following as the loop item:

<a href="/finish-gallery/?
   <!-- wpv-loop-start -->
      <wpv-loop>
            finish-style%5B%5D=[wpv-taxonomy-id]&
      </wpv-loop>
   <!-- wpv-loop-end -->
"></a>

Is there even a way to set the taxonomy term filter to a slug? If so, I'd prefer not to have to use a view if I don't have to.

#1311923

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Thanks for the details, in your case, there is a easy workaround, you can create a taxonomy view to output the term's IDs, for example:
1) Create a taxonomy view "finish-style-ids":
- Query terms of taxonomy "finish-style"
- Filter by:
Taxonomy is set by the current post
- In section "Loop Editor", within shortcode <wpv-loop> ... </wpv-loop>, display the term's IDs like this:

...
<wpv-loop>[wpv-item index=1]finish-style[]=[wpv-taxonomy-id][wpv-item index=other]&finish-style[]=[wpv-taxonomy-id]</wpv-loop>
...

- Enable option "Disable the wrapping DIV around the View" , this will be able to remove extra HTML div tags.

2) Use above taxonomy view to output the link, like this:

href="/finish-gallery?[wpv-view name='finish-style-ids']"

Then test again

#1313401

I had already figured out a way to incorporate the taxonomy term id into a view loop, prior to your latest post, simply because the [wpv-post-taxonomy] shortcode doesn't support taxonomy IDs as an output type. I just needed the syntax for passing multiple filter arguments through a URL parameter, which you did in your initial post.

Thanks for your assistance!