- This topic has 5 replies, 3 voices, and was last updated 1 month, 3 weeks ago by David.
July 28, 2021 at 8:37 pm #1875196Luiz Guilherme
Using “page hero” + “Generateblocks”, I created a template with a custom fallback image (I disable the post image) and applied it to the entire site.
However, on category pages that do not return any results, the image is not displayed.
If I also set a solid color for the background, that color is displayed, but the image never is.
Immediately after I assign some post to category, the background image starts to be displayed.
Is this a bug?July 28, 2021 at 9:33 pm #1875222ElvinStaffCustomer Support
This isn’t a bug but a default behavior.
Category archives don’t have featured image by default so it just fetches the featured image of the first post it gets.
You can add a fallback image to the container block’s Background tab so there’s still a default fallback image for the empty categories.
But if you want a featured image for each category, you’ll need a plugin that allows you to do for them as WordPress default doesn’t have this feature.
A wise man once said:
"Have you cleared your cache?"July 29, 2021 at 4:22 pm #1876374Luiz Guilherme
As I explained, this is exactly what I did.
“Set a fallback image”
And it doesn’t show up on the pages I’ve quoted.
Take a test:
* Define a fallback image.
* Create a category, and do not assign any posts to this category.
* Access this category “No posts”.
* You will see that the image will not be displayed.
* By assigning any post to this category the fallback image will be displayed.July 30, 2021 at 6:07 am #1877027DavidStaffCustomer Support
the function currently relies on checking the
current-postfor its ID. Without the ID the rest of the conditional checks would fail so the function simply returns nothing. So it doesn’t ( and wasn’t intended to ) work for templates that don’t support Featured Images or Custom Fields. e.g Category Archives.
Its an odd one to fix as when would you want to display an empty Archive ?
But i can have a chat with Tom regarding this – as it might be something we can easily change.July 30, 2021 at 1:50 pm #1877726Luiz Guilherme
Thanks for the feedback.
In fact, no one wants to display an empty archive page, or an empty search result.
However, this can happen, and this would affect the user experience, seeing a broken and incomplete page.
I always like to cover all gaps to give the user the best experience possible.July 31, 2021 at 2:48 am #1878112DavidStaffCustomer Support
We’re looking at what is possible there.
Currently the best way to make sure its not missing an image is to use Element specifically for archives that uses a static image. We’ll see what we can do 🙂
- You must be logged in to reply to this topic.