How To Change WordPress Header Image

How To Change WordPress Header Image

Custom Header is a Theme feature though which WordPress Header Image can be changed easily from the ‘Appearance > Header’ section. Most of the time the ‘header image is used as ‘website logo’ therefore it becomes important that theme developers should enable this feature in their theme.

Enabling WordPress Custom Header

To enable Custom Header add the below code in your theme’s functions.php file –

/*Custom header*/
	$args = array(
	'width'         => 300,
	'height'        => 150,
	'default-image' => get_template_directory_uri() . '/Images/logo.png',
    );
    add_theme_support( 'custom-header', $args );
/*End*/

Explanation – In the above code we have enabled the Custom Header feature and provided the width, height and also the default image location to the header image.

Showing WordPress Custom Header

Open your theme ‘header.php’ file and add the below code where you want the custom header to show.

custom header

Now the site owners can upload the image from the ‘Appearance > Header’ section and can use for changing their website logo.

Changing Custom Header Image

Changing Custom Header Image

Share this article -

yogihosting

ABOUT THE AUTHOR

This article has been written by the Technical Staff of YogiHosting. Check out other articles on "WordPress, SEO, jQuery, HTML" and more.