Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Add logo in theme customize option in wordpress

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 842
    Comment on it

    Hello reader's today we discuss about "Add logo in theme customize option" in wordpress. Open your function.php and paste the below code :-

    /**
     * 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',
        ) ) );
    }
    

    Now open your header.php file and put the below code in place of logo image :-

    <img src="<?php echo esc_url( get_theme_mod( 'custom_logo' ) ); ?>" alt="logo" />
    

    I hope this help you, thanks.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: