I am trying to display conditional-html-output-in-views on category archive pages to hide/display titles.
I've tried codes like
[wpv-conditional if="( '[wpv-taxonomy-archive]' eq 'filters' )"]FILTERS ON [/wpv-conditional]
[wpv-conditional if="( '[wpv-pager-archive-current-page]' eq 'filters' )"]FILTERS PAGE [/wpv-conditional]
[wpv-conditional if="( '[wpv-taxonomy-title]' eq 'filters' )"]FILTERS ON[/wpv-conditional]
[wpv-conditional if="( $(wpcf-vent-geluidsniveau) eq '39-decibel,42-decibel,49-decibel,52-decibel' )"][wpv-conditional if="( $(wpcf-vent-geluidsniveau) eq '' )"]GELUIDS NIVEAU IS AAN[/wpv-conditional][/wpv-conditional]
I would like to display Titles when a specific search field is found on the page.
Link to a page where the issue can be seen:
hidden link
I see in the previous ticket the topic was "How would be the best way to hide labels of fields that do not show up".
It seems rather different to what you show me above.
What exactly are you trying to achieve?
You cannot display Custom Search items conditionally, you could maximally use the Settings in the Views Custom Filter settings for what to do when certain terms have no posts.
Conditional HTML is used to check if a field exists, if yes, show it.
Or, as example, if you are logged in, show something else than to a logged out user.
Please can you let me know the exact goal you have in mind?
If it's only about " would like to display Titles when a specific search field is found on the page.", if I understand this correctly, you want to show something only if the user searches by a certain term?
Then you can use the ShortCode "[wpv-search-term param="your_search_term"]"
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term
This will return the value that the user searched for, listening to an URL parameter (your_search_term).
Then, this can be used in a Conditional, like:
[wpv-conditional if="( '[wpv-search-term param="your_search_term"]' eq 'searched word' )"]FILTERS ON [/wpv-conditional]
"I would like to display Titles when a specific search field is found on the page." is NOT what I meant to say... I apologise.
Yes what I would like to accomplish is what i mentioned in the other ticket.
"How would be the best way to hide labels of fields that do not show up"
Thank you.
OK:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/
This is a working syntax using one simple line field:
[wpv-conditional if="( empty($(wpcf-test-field)) )"]
This field is empty or does not exist[/wpv-conditional]
You can also use the GUI, this is suggested.
When doing so hit the button "Conditional output" in the Editor and choose the right source field to check upon.
Then just set the condition to "!=" and the value to compare you leave empty.
Insert this condition. It is now only showing it's contents if the field you addressed is not empty.