I have a custom image term field for the taxonomy "Cities" where I upload an image I want to show on the city archive page. IF the city has an image, I want to display that image on the page. IF a city does NOT have an image uploaded, I want to display a default image.
The following code properly displays an image, IF the city has an image: [wpv-taxonomy-field name='wpcf-background-image']
SO, i figured the following WPV-CONDITIONAL would evaluate whether or not there was an image attached:
IF Empty (False) - [wpv-conditional if="( empty($(wpcf-background-image)) )"] ...url of default image here... [/wpv-conditional]
IF Attached (True) - [wpv-conditional if="( $(wpcf-background-image) )"] [wpv-taxonomy-field name='wpcf-background-image'] [/wpv-conditional]
BUT, it doesn't work. I found a note from Nigel in another thread that images cannot be properly evaluated...SO, I added a check box termfield called "background-uploaded" and I tried using that to evaluate. Since checked box has a value of "1", and unchecked would be blank, I tried the following:
FINALLY, I tried this, but the nested shortcode gave an error. SO, i added the "wpv-taxonomy-field" shortcode in the Toolset frontend settings to allow nesting, but it still didn't work.
Hello. Thank you for contacting the Toolset support.
What if you try to use the following conditional method:
[wpv-conditional if="( '[types termmeta='background-image' output='raw'][/types]' ne '' )"]
<p> Image is available so display the image </p>
[types termmeta='background-image'][/types]
[/wpv-conditional]
[wpv-conditional if="( '[types termmeta='background-image' output='raw'][/types]' eq '' )"]
<p>There is no image - so display here default image </p>
[/wpv-conditional]