Skip Navigation

[Resolved] Please help with URL parameters

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

Problem:
How to filter the view by custom field with URL param.

Solution:
You can filter by as many custom fields as you need, filter by hard-coded values or let visitors choose filter values.

Relevant Documentation:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

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

Last updated by keithT-3 7 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#550573
Screen Shot 2017-07-19 at 4.23.07 PM.png
Screen Shot 2017-07-19 at 4.21.44 PM.png
Screen Shot 2017-07-19 at 4.15.26 PM.png

I am trying to: get a URL parameter passed from a URL to a view. This is the URL -
hidden link
Attached is how I have my query set up based on what I think it needs to look like.

Currently I have a page that list all the countries I need -
hidden link. But I am accomplishing this by a bunch of different views, see attached for a sample.

What I want is to be able to dynamically create a page that shows listings for a single country. So the page would show an intro paragraph and single country, like the attached that just shows Australia.

In a perfect flow, I'd actually be able to pass the URL variable from my Gravity Form based on a dropdown selection.

I visited this URL:

I expected to see: I want this page, if the country parameter in the URL is "au" to only show records where the country = Australia or au in the list.

Instead, I got: all my records, as seen here -
hidden link

#550641

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - I checked the following URL and I do not see any relation of country with any of the item.
=> hidden link

I can better tell you once I review your current setup and then I can advise you what will be steps you need to follow.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#551188

Minesh
Supporter

Languages: English (English )

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

I checked your setup and on this page:
=> hidden link

I see you added veiw "Provider - International" which is filter by country.

Now, I set above view filter by URL param and with "AU" and it works find and results filtered correctly.

The thing is that, your country field is set to hold country code (2 characters) rather full country so there is no automatic way to convert "AU" to "Australia" or views will not work like this because it will match "au" so it will give you results with "Australia" as well as "Auckland".

If you want to match whole country name then you need to add full country name.

#551370

Thank you so much. I see now. I also created a new view so that I can have a paragraph above that describes the page and includes their particular country in the text and as a headline for the list below. See my updated page - hidden link. It does mean I'll need to go through the records and put in the full country name. I don't think I'll worry about changing the US though because we have nearly 400 of those. Guess I could change it via a database query.

#551395

Minesh
Supporter

Languages: English (English )

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

Yes - you can change it using database query but please make the full backup of your database first.

All custom post fields will be saved to post meta table.

#552572

Thank you.