Skip Navigation

[Resolved] Conditional statement to show iframe vs img tag based on content of field

This support ticket is created 7 years, 9 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Shane 7 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#416737

I am trying to: add a conditional statement to a content template to display an iframe if the content of the field contains the word "youtube" in it or the img src="... if the content of the field contains ".jpg" or ".png"

I see an option for "=", but the field has to be that exact phrase used in the statement for it to work. Each URL is going to be different, but if an image or video, it will have one of the phrases in it.

I visited this URL: hidden link

I expected to see: nothing yet, this conditional statement has not been added.

Instead, I got: a broken image link because the image has a youtube URL and not an image URL.

#416761

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Heather,

Thank you for contacting our support forum.

Currently taking a look at what your are trying to achieve, it goes out of the scope of what our conditionals can do.

Its not able to evaluate an entire statement for a single character. This would require a more complex conditional statement and as such would need to be custom written.

Our conditional is only able to evaluate against an exact value of a field. So if there is a text field and the only text in it is Youtube then you can evaluate that.

Please let me know if this helps.

Thanks,
Shane

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.