Skip Navigation

[Closed] Conditionally display a views search filter based on Archive Title

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.

Our next available supporter will start replying to tickets in about 1.63 hours from now. Thank you for your understanding.

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 10 months, 1 week ago.

Author
Posts
#2619861
Screenshot 2023-06-29 at 4.19.52 PM.png

Tell us what you are trying to do?

I am trying to conditionally display Views Search Filters based on the Archive Title.
In setting up the view I have a Conditional block shown in the image below.
but the condition test will return false even if I'm on the archive page.

in a separate container I had set up to display the title of the archive just to verify the logic.

Is there any documentation that you are following?

Is there a similar example that we can see?
the section is currently set to be available to specific users. please request for credentials in your reply.

the debug information appended here:

####################
wpv-conditional attributes
####################
Array
(
[if] => ( ( 'ltspan>Vetslt/span>' = 'Vets' ) )
[debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ( ( 'ltspan>Vetslt/span>' = 'Vets' ) )
--------------------
After replacing 1 general variables and comparing strings: ( ( 'ltspan>Vetslt/span>' = 'Vets' ) )
Comparing ltspan>Vetslt/span> to Vets

with the above debug information, i changed the static value to "ltspan>Vetslt/span>" to achieve a 'true' result.
Is it supposed to be used this way?

What is the link to your site?

#2619925

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

I suggest you add the shortcode to the custom archive so that you can see what it actually outputs, which is what you need to compare it against in your condition.

[wpv-archive-title]

On my own test site, for example, I have a CPT "Things", and on the archive for Things the actual output of the wpv-archive-title shortcode is "Archives: Things", so that's what I would need to test for with my condition rather than simply testing for "Things".

The topic ‘[Closed] Conditionally display a views search filter based on Archive Title’ is closed to new replies.