I have a related products View on a single product page layout that I wish to display conditional styles based on if the post in the View output matches the current page.
I have the view built out (versteckter Link) and you can see what I'm attempting to replicate from the mockup here: versteckter Link
I suppose I could work in a strictly CSS or jQuery solution, but I wanted to see if I could use Toolset's Conditional Arguments to conditionally display a class name in the loop output that specifically applies the styles I'm looking to apply. The class I'm intending on using is simply gonna be labeled "disabled" and I'm going to have the styles already worked into stylesheet.
Any help in this manner would be greatly appreciated. Thanks in advance!
Hi,
You can use the attribute item="$current_page" in Toolset shortcodes, to get the information from the current page:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
For example, to get the ID of the current page, you can use the 'wpv-post-id' shortcode, like this:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-id
[wpv-post-id item="$current_page"]
The same shortcode can be used in the conditional statement in a view's loop to compare the current page's ID and the current loop result's ID:
<div [wpv-conditional if="( '[wpv-post-id]' eq '[wpv-post-id item="$current_page"]' )"]class="current"[/wpv-conditional]>
......
</div>
regards,
Waqar
Brilliant! This works as advertised (versteckter Link). Thank you for the assistance.