Skip Navigation

[Resolved] Pass URL parameter to target page

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

Problem: I would like to add a URL parameter to a link's destination URL so I can use that URL parameter as a View filter.

Solution: In a loop, you can use Views Shortcodes to build the HTML for a link tag with a URL parameter like this:

<a href="[wpv-post-url]?country-id=[wpv-post-id]">[wpv-post-title]</a>

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/

This support ticket is created 6 years, 10 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 6 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#603857

I am trying to:
Create custom post with CRED post form but with parent-child-grandchild relations.
https://toolset.com/forums/topic/how-create-grandchild-post-with-cred-post-form-with-parent-and-child-relations/

Link to a page where the issue can be seen:
hidden link

I expected to see:

Thanks for the details, there isn't such an exact same feature within CRED form, but here is a workaround:
1) You can create a view list all "Country" posts, pass URL parameter "country-id" to target page,
2) In the target page setup a view list "city" post, filter with post relationship by the URL parameter "country-id":
and setup link to pass URL parameter "city-id" to anther target page
3) In the anther target page, display the CRED form for creating "house" post, use the URL parameter "city-id" as the default value of parent "city" field:urlparam. Optional. A URL parameter to set default value.

Instead, I got:
You can create a view list all "Country" posts, pass URL parameter "country-id" to target page,
Sorry, I can't find a way to pass URL parameter. How to do this? Yes, I've created view lists "All countries" and "All cities"
I can see all results, so all the cities and all the countires, but how to pass URL paremeter to target page?

Is this somewhere in Query Filter section or for this goals I must have some other ways?

#604080

Sorry, I can't find a way to pass URL parameter. How to do this?
In a loop, you can use Views Shortcodes to build the HTML for a link tag with a URL parameter like this:

<a href="[wpv-post-url]?country-id=[wpv-post-id]">[wpv-post-title]</a>

We have more information about different Views Shortcodes available here:
https://toolset.com/documentation/user-guides/views-shortcodes/