Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to add custom logo in wordpress

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 326
    Comment on it

    Many of the wordpress themes are having options in admin panel for uploading and changing the logo. But if we want to make a custom logo that is used in converting HTML to wordpress or for making any custom wordpress theme or we do not have any option in theme then we can create a custom logo for every custom wordpress site.

    We can add custom logo by adding few lines of code in wordpress theme's header.php file and functions.php file.

    In functions.php file , we can just copy this function
    /**
     *  use custom logo.
     * Add logo in theme customize option.
     */
    add_action( 'customize_register', 'wp1_customize_register' );
    function wp1_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',
        ) ));
    }
    

    After adding the function in functions.php , we have to call the logo in the header.php file.

    We can just add the below code in theme's header.php file for calling the logo.

    <?php echo site_url(); ?"<img src="<?php echo get_theme_mod( 'custom_logo' ); ?
    

    after calling the logo in header.php , we can easily change the logo from wordpress backend by going to appearance-customize.

    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: