Archived topic
Make page hero retina-ready
19 replies · Started by mkjj on June 17, 2021
Glad to be of help - and thanks for the great feedback!
Hi again,
yesterday, I ran into one minor problem using this solution. It works awesome for pages, but not for the blog page, archive pages, single posts etc.
Let's say, I want to make the header element for the blog page retina-ready. I could modify the function like so
if( is_page() || is_home() ) {...
However, this will grab the featured image of the first post and not of the blog page itself. I know, I could use CSS like so:
.blog .page-hero, .archive .page-hero, .single-post .page-hero {...}
Is there a more elegant solution for this? It's not a big deal, since the same hero image is used for these pages. So, the CSS solution would be fine, but I just wanted to ask anyway.
Yeah, theres no simple 'dynamic' solution for that. The CSS method would be the best way to go.
Thanks, David. That's ok, since the same image is used for several pages.
You're welcome