You can do it in a very 3-step coding.
1- Go to functions.php and add the following code
function
themename_custom_logo_setup() {
$defaults
=
array
(
'height'
=> 100,
'width'
=> 400,
'flex-height'
=> true,
'flex-width'
=> true,
'header-text'
=>
array
(
'site-title'
,
'site-description'
),
);
add_theme_support(
'custom-logo'
,
$defaults
);
}
add_action(
'after_setup_theme'
,
'themename_custom_logo_setup'
);
2- Go to your WP dashboard --> Theme --> Customize --> Add your logo
3- Add the following code to your header.php where the logo should be displayed.
if
( function_exists(
'the_custom_logo'
) ) {
the_custom_logo();
}