Create a new field to upload logo in wordpress theme

As previously, i was a front-end developer. I always try to find more convinient and user friendly answers for my problems.  as i have found a very important and necessary logo upload field that every custom WordPress theme developer should implement in its there for more convenient and user friendly template.

Below is the code to paste at the bottom of function.php in your theme folder.

// insert logo

function themeslug_theme_customizer( $wp_customize ) {

$wp_customize->add_section( 'themeslug_logo_section' , array(

'title' => __( 'Logo', 'themeslug' ),

'priority' => 30,

'description' => 'Upload a logo to replace the default site name and description in the header',

) );

$wp_customize->add_setting( 'themeslug_logo' );

$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'themeslug_logo', array(

'label' => __( 'Logo', 'themeslug' ),

'section' => 'themeslug_logo_section',

'settings' => 'themeslug_logo',

) ) );


add_action('customize_register', 'themeslug_theme_customizer');


Filter the name and email address from wp_mail



    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'custom_logo', array(

        'label'   => 'Custom logo',

        'section' => 'ignite_custom_logo',

        'settings'   => 'custom_logo',

    ) ) );


Now there will be a new option available in your theme customizer  for logo upload.

Now we have a field but how to echo this field value in your theme?

And answer is below code.

< a shape="rect" class="logo" href="" title="" rel="home">< img src="< /a>

And you can also use this to create and access as many fields you want . Just customize the code (very easy) and its ready with new field

I have +4 years of quality experience in Front-End Developer from India. I have worked on HTML5, CSS3, JSON, XML, Angular, jQuery, WordPress, Bootstrap for developing tabled, table-less, responsive and non-Responsive web-sites. I have worked on many complicated and easy design in some top level web development companies in India while also working on independent projects as freelancer.

Got something to say? Go for it!