Skip Navigation

[Resolved] conditional shortcode

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 8 months ago.

Assisted by: Waqar.

Author
Posts
#2693979

Hello,

On the page hidden link
I want search results only to appear when some value is put into the search box. Now there are always results.

I think I need a conditional shortcode. I tried the following:

[wpv-conditional if="( '[wpv-search-term]' ne ' ' )"]
....
[/wpv-conditional]

but this does not work.

Please help.

#2694042

Hi,

Thank you for contacting us and I'd be happy to assist.

Your approach is correct, but the 'wpv-search-term' shortcode also needs the 'param' attribute:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-search-term


[wpv-conditional if="( '[wpv-search-term param="wpv_post_search"]' ne '' )"]
...
[/wpv-conditional]

regards,
Waqar