Skip Navigation

[Resolved] Split: How to conditionally show featured image

This support ticket is created 4 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by amberA-2 4 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#1530341

Can you tell me else statement. I am applying if condition but I think if and else both working at same time.
[wpv-conditional if="( '[wpv-post-featured-image output="url"]' eq '' )"]
<img src="hidden link">
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-featured-image output="url"]' eq '[wpv-post-featured-image output="url"]' )"]
<img src=" [wpv-post-featured-image output='url']">
[/wpv-conditional]

I need featured image show when its url is there otherwise preview image will show.

#1530351

Nigel
Supporter

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

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

Screenshot 2020-02-27 at 10.36.26.png

Notice in the screenshot how the code editor highlights some of the code in red?

That's because the wpv-conditional shortcode is broken, you need to be careful with mixing single quotes and double quotes.

The entirety of the if argument should be within double-quotes, and you cannot use any other double-quotes inside of the if argument, you must use single-quotes.

Your second condition doesn't need to be so complex. If the first condition tested if the featured image URL equals an empty string, the second condition can simply test if it is NOT equal to an empty string.

I fixed both of these on your site if you can check if it works as expected.

#1530407

My issue is resolved now. Thank you!