Header image loads already on static front page

Hi there
It’s a real pleasure to work with your Sydney theme! My website sub.ferien-provence.com is almost finished.

While optimizing the page speed I realized that the header imgage is loaded immediately although I chose a static front page, where this header image is not used. I would like to load this image only later on my subcategory pages when it is needed: Is there any simple way to do this?

Thanks for your help,
Rainer

Hello there,

To completely remove the header image element while header slider is active, you’ll need to edit the header.php file in child theme mode. The first thing to do is to create a child theme or use our premade one. Then in the child theme folder, you’ll need a copy of the header.php file from main theme. Edit this file and find the below code block:


<div class="header-image">
	<?php sydney_header_overlay(); ?>
	<img class="header-inner" src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>">
</div>

And replace it with:


<?php if ( get_header_image() && get_theme_mod('front_header_type') == 'image' ) { ?>
	<div class="header-image">
	<?php sydney_header_overlay(); ?>
	<img class="header-inner" src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>">
	</div>
<?php } ?>

Then log into your site admin area and then install and activate the Customizer Export/Import plugin to backup your customizer settings. Visit Appearance > Customize > Export/Import and download the settings file. Then install and activate the child theme. If your customizer settings can’t be synced instantly, import the the downloaded settings file via Customizer.

Regards,
Kharis