Skip Navigation

[Resolved] Question about “Passing Arguments to Views”

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user had a view filter that is currently being filtered by the URL parameter but wanted to re-use this same view and then filter it by a shortcode parameter with the same filter.

Solution:

We actually have the perfect filter for this.

Take a look at the filter below.
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_custom_field_filter_original_value

This should allow you to achieve this exact scenario.

This support ticket is created 6 years, 9 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 2 voices.

Last updated by koheiY 6 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#614609
ads-list-table-filter.JPG
filter-by-taxonomy.JPG

I have a question about "Passing Arguments to Views".
https://toolset.com/documentation/user-guides/passing-arguments-to-views/

I set up the reference site Classifieds/listing site in my server.

What I want to do is to display view "Ads list - table" filtered by location "Boston"

I create a new page and write code.

[wpv-view name="ads-list-table" location="boston"]

The view "Ads list - table" appeared but was not filtered by location "Boston".

What is wrong?

Attached is "Ads list - table"'s query filter and my page's screenshot.

#614706

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kohei,

Thank you for contacting our support forum.

From the looks of it you want to filter by a location. Is this location a taxonomy ? Also I see you want to do the filter by the shortcode parameter method.

Please let me know if this parameter is a taxonomy and if its already apart of the filter.

From what I see you want to reuse this view on another page and filter it by the shortcode parameter?

Please let me know.
Thanks
Shane

#614719

Hi Shane,

> Please let me know if this parameter is a taxonomy and if its already apart of the filter.
Yes, "location" is a custom taxonomy and it's already apart of the filter.

> From what I see you want to reuse this view on another page and filter it by the shortcode parameter?
Yes.

Now, hidden link has no data,but the filtered url is

hidden link

I want to reuse this filtered view on another page .

#614746

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kohei,

We actually have the perfect filter for this.

Take a look at the filter below.
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_custom_field_filter_original_value

This should allow you to achieve this exact scenario.

Please let me know if this helps.
Thanks,
Shane

#614778

Hi Shane,

Do you mean, I need to add these codes in my functions.php before passing arguments to views?

add_filter(XXXXXXXXXXXXXXXXXXXX

The method explaining on this url (https://toolset.com/documentation/user-guides/passing-arguments-to-views/) doesn't work without adding

add_filter(XXX

in functions.php ?

#614812

I resolved. Thank you!