Working on a view for news items. Some have a large image (hero size) at the top but most don't. If there is an image I want the page title to be in white over the image. If there isn't an image I want the title to display in black.
My code:
[wpv-conditional if="( $(wpcf-large-hero-image) ne '' )"]<div class="news-item-white-title">[wpv-post-title]</div>[/wpv-conditional]
[wpv-conditional if="( $(wpcf-large-hero-image) eq '' )"]<div class="news-title">[wpv-post-title]</div>[/wpv-conditional]
It displays the image with white text ok, but does that 1st condition even when there isn't an image. You can see in the output the source is like this: src=""
I'm wondering if the plugin is saving a null value or something that doesn't look empty.
view is: "View for News Item Details"
View is used on news detail screen. Go to "News & Ideas" and click one for details.
I created a new user for you guys and I created a duplicator package but I'm not sure what the path would be. You can see the package in the admin area.
The easiest to check why conditionals do not work is to see what their checked value actually outputs.
So if you check against a Custom Field "wpcf-large-hero-image" try to output that field with the ShortCode and analyse in the Front End HTML if something is output or not.
In case it's not, then the field is empty and will respond to ='', however, there are also few exceptions, where a field seems to not output anything but indeed it does, such field, for example, is the post content (https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-custom-functions-in-conditions/#checking-for-empty-post-content), featured image, or all special cases listed here https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/#special-cases.
I am however not sure why you use a View to return one single item and display that on a single post.
You can just apply the conditional in a Layout styling those posts.
Views would be for when displaying many items by a query, usually, while if you style one post, you can do this directly in Layouts.
I am also having difficulties to locate the precise URL where I should see the issue since View hidden link is not used on hidden link for example, I cannot see the output of it in that post, which I reached after clicking any post in hidden link
Seeing this might enable me to check why it's not working if the above test does not tell already.
Thanks!
My issue is resolved now. Thank you!