Passer la navigation

[Résolu] conditional shortcode

This support ticket is created Il y a 2 years, 1 month. 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
- 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 -

Fuseau horaire du supporter : Asia/Karachi (GMT+05:00)

Ce sujet contient 1 reply, a 2 voix.

Dernière mise à jour par Waqar Il y a 2 years, 1 month.

Assisté par: Waqar.

Auteur
Publications
#2693979

Hello,

On the page lien caché
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