Layout Designer (single post): How do I hide a featured image if there is no featured image set for a post?

I am using the Theme x Pro Layout Designer to design a custom layout for my single posts.

And I have added the featured image to the top of the layout using the dynamic image source {{dc:post:featured_image_id}}.

This works great, but sometimes a post does not have a featured image, and this creates a broken image on the front end.

So how do I conditionally hide the featured image if no featured image is set for the post?

Hi @thecashbag,

Thank you for reaching out to us. You can do this by using Element Conditions. There’s a condition called “Featured Image” and you can check for “Is set” and “Not is set”. under Customize > Element Conditions click the “is set” to make sure it is only displayed when the featured image is set.

In case you want to show a default image if a featured image is not set then you can follow this thread: Conditionals: Default featured image if none is set?

Hope this helps!

Thanks this worked a treat!

I’ve got another similar question for Conditionals.

I have a date displayed for the post. Usually it says somethibg like “August 10, 2021”.

But if the post has been updated after the published date I would like it say something like “Updated August 20, 2021”.

Is it possible to do that?

I was hoping I could show/hide the “updated” version if the modified date was after the publish date, but I can’t see how to do that in the Conditionals because the Before/After Condition needs a hard coded date to compare against. I can’t compare modified date to published date.

Hello @thecashbag,

Regretfully there is no option to show/hide or set conditions on “Updated” text whether the post is modified or not.

In case if you want to display the modified date you can use the dynamic content code.
{{dc:post:modified_date format="F j, Y"}}

bloglayout-Layouts-Pro

Hope it helps
Thanks for understanding

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.