Skip Navigation

[Resolved] conditional with url parameter

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.

This topic contains 1 reply, has 1 voice.

Last updated by MattI4840 3 weeks, 3 days ago.

Author
Posts
#2792300

Tell us what you are trying to do?

I'm attempting to create project pages with content that is hidden unless a specific url parameter and value is present. I'm attempting to do so with a conditional statement on a content template but I'm not having any luck thus far.

What is the link to your site?

hidden link

#2792311

I've continued testing different ways to achieve the goal of hiding specific data dependent on url parameters, I created a new field for the custom post type that holds the URL with the params (Conditional URL). I then set up a conditional that compares the post url with the 'Conditional URL' field, and if equal it should display the content in the conditional, if not it should hide it. However this also does not work as expected. Here is an example:

Page URL: hidden link

Conditional URL: hidden link

Regardless of what URL you use, you can still see the text block that is inside the conditional. I'm unsure as to why this would be since the two strings are clearly not equal.

I'm entering the Conditional URL manually now, but since this will be in a post template, my plan was to use a shortcode for that value so it works on all pages. Just FYI in case you see an issue with that approach. Any help you can provide here is greatly appreciated.

Thanks!

#2792322

I was able to get this working by creating a custom shortcode to capture the paramater value from the url, and comparing it to the paramater value stored in the a custom post field that holds.