Archived topic
How to set fallback image in Template created with Generatepress?
8 replies · Started by Luiz Guilherme on April 2, 2022
Hi. How are you?
I Need to Know How to set fallback image in Template created with Generatepress?
There are 2 situations where this is important.
01 When a post is published without an image.
02 When an image is deleted by mistake from the hosting.
In these 2 cases, when creating a Template with Generatepress (to display a search result for example), no image is displayed.
How to get around this?
Very thanks.
Hi there,
Edit the Block Element - Content Template you're using. Select the parent Container, and in the Toolbar click the Dynamic option for the background image:
https://docs.generatepress.com/article/dynamic-data/#dynamic-background
When you do so you will see a toggle to Use Fallback Image:
https://www.screencast.com/t/vfDWd4hDK
Enable that and it will use the Background image you applied to the Container Block
Hey David.
This was exactly what im lookin for.
Thanks brother.
Hey David.
Sorry to come back here. See, in the posts where there was no image set his instruction worked.
But in cases where the image has been removed from the server, it still remains unimaged.
See the attached link. Would it be possible to set the fallback image in these cases too?
Unfortunately not.
You will need to remove the image from the featured image field.
Perfect.
What do you think they study the possibility of adding this feature, so that the theme when realizing that the image was not found (in case it is deleted) the fallback image is used.
I would say that the occurrence of this is quite rare.
Generally, when users want to remove a featured image, they go to featured image field to remove it and not just remove it straight from the server.
Yes I agree.
But I don't mean the situation where the user wants to remove the images. I am referring to cases where images are lost without intention.
In a server problem, when images get corrupted, image or folder names are changed, or in migrations, and restores. This is my case now.
Imagine in a case with hundreds or thousands of images.
Anyway, it would be a way for the theme to mitigate these problems before they even occur, it would be a great advantage over the others in my point of view.
I hope you consider.
Thanks.
Thanks for the suggestion!