Skip Navigation

[Resolved] Conditional tag based on Url

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

Problem:
Conditional tag based on Url

Solution:
To display conditional output based on the URL param value, you can use the [wpv-conditional] shortcode in order to display conditional output.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/conditional-tag-based-on-url/#post-1294399

Relevant Documentation:

- https://toolset.com/documentation/legacy-features/views-plugin/checking-fields-and-other-elements-for-emptynon-empty-values/

- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-search-term

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

Last updated by antonioA-9 5 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#1294075

I'm trying to insert a category list views in the following page hidden link

I would like to insert in this view a conditional tag with content only when a specific category is displayed. It is possible to write a conditional shortcode that do so? HWen the slug displayed is "wpv-category=franchising"?

Thanks

#1294399

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

As I understand - you want to display conditional output based on the URL param value "franchising". If yes, you can use the [wpv-conditional] shortcode in order to display conditional output.
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/

You can catch the URL param value using the shortcode [wpv-search-term]:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

For example:

[wpv-conditional if="( '[wpv-search-term param='wpv-category']' eq 'franchising' )"]
condition is TRUE AND URL param wpv-category == franchising
[/wpv-conditional]
#1306313

Thanks a lot.