Tell us what you are trying to do?
Currently have a view that lists all of the terms in a taxonomy
We are controlling which posts display on the page through a URL variable “?wpvcategory=blogs”
I would like to conditionally add a CSS class name to highlight the current taxonomy that is present in the URL parameter.
Similar to how the current page in a page is highlighted.
I am basically looking to add: [if ('wpvcategory' ne ="")]class="currentcategory"[/if] to the view loop
Is this possible?
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site?
hidden link
Hi,
Thank you for contacting us and I'd be happy to assist.
You can use the shortcode 'wpv-search-term' to get the value from the URL parameter 'wpvcategory', like this:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-search-term )
[wpv-search-term param=wpvcategory]
The same can be used in the conditional statement to match the current taxonomy's slug, like this:
( ref: https://toolset.com/documentation/legacy-features/views-plugin/using-shortcodes-in-conditions/)
[wpv-conditional if="( '[wpv-taxonomy-slug]' eq '[wpv-search-term param=wpvcategory]' )"] class="currentcategory"[/wpv-conditional]
I hope this helps and please let me know if you need further assistance.
regards,
Waqar