-
Anonymous
Hello Support Team,
I would like to stop using CSS to set the background image in my header and instead include it directly as an image element.
<header class="site-header grid-container" id="masthead" aria-label="Website"> <div class="inside-header grid-container"> <div class="site-branding-container"> <div class="site-logo"> <img class="header-image is-logo-image" alt="Museovia" src="/wp-content/uploads/logo_web.png" width="59" height="62"> </div> <div class="site-branding"> <p class="main-title">xxxx</p> <p class="site-description">xxxx weltweit entdecken</p> </div> </div> <div class="site-background"></div> </div> </header>This means I want to embed the image within the div like this:
<div class="site-background"><img alt="image" src="/wp-content/uploads/start-img.png"></div>Is there a hook for this?
Kind regards
Jens -
Alvind
Hi Jens,
You can try the
generate_after_header_contenthook. For example:add_action( 'generate_after_header_content', function() { ?> <div class="site-background"> <img src="<?php echo esc_url( home_url( '/wp-content/uploads/start-img.png' ) ); ?>" alt="image" decoding="async" > </div> <?php }, 1 );
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.