As part of redesigning our site, we want to make sure that every entry for a specific channel is displayed with an image. All the content posted does not have good specific images associated with them, so I am looking for a good way to assign a pool of default images to the channel. Then, if an entry does not have a specific image associated with it, it would instead be displayed with a random image from the default set.

Is this doable? I am on EE 5.x.


Yes, off-course it is doable. For this you need to create Template Variable for storing the placeholder image. You just need to call this placeholder image when there is no image in file field.

You should try code in below manner.

{if file_field_name}
    {!-- Image field name associated with channel --}
    {!-- Placeholder Image (variable_name) --}

enter image description here

  • Thanks, haven't made much use of template variables, so it didn't occur to me. Looks like a very elegant solution! – Linda Antonsson Feb 18 '19 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.