Hello Reader's!
If you are new to wordpress and need to set your own logo from admin then you can use the wordpress custom logo management in the code:-
First create of open the file, Functions.php in the root directory.
now paste the code below:-
/**
* Add logo in theme customize option
*/
add_action( 'customize_register', 'themename_customize_register' );
function themename_customize_register($wp_customize) {
$wp_customize->add_section( 'ignite_custom_logo', array(
'title' => 'Logo',
'description' => 'Display a custom logo?',
'priority' => 25,
) );
$wp_customize->add_setting( 'custom_logo', array(
'default' => '',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'custom_logo', array(
'label' => 'Custom logo',
'section' => 'ignite_custom_logo',
'settings' => 'custom_logo',
) ) );
}
//This code will be shown of admin panel where you can set or remove the logo for your website.
Now open the header.php file and in the place of logo paste the code below:-
<?php echo esc_url( get_theme_mod( 'custom_logo' ) ); ?>
0 Comment(s)