Adding a logo uploader  to your WordPress theme with the Theme Customizer
Here Simple code of   adding logo   in wordpress theme   
   $wp_customize->add_section(   'myblog_logo_section' ,   array( 
    'title  '       => __(   'Logo', 'myblog  ' )  ,
    'priority  '    => 30,
    'description ' => 'Upload a logo to replace the default site name and description in the header',
) );
$wp_customize->add_setting(  'myblog_logo' ) ;
$wp_customize->add_control(  new WP_Customize_Image_Control(  $wp_customize, 'themeslug_logo', array( 
    'label '    => __(  'Logo', 'myblog ' ) ,
    'section '  => 'myblog_logo_section',
    'settings'  => 'myblog_logo',
) ) );
}
add_action( 'customize_register','myblog_customize_register');
<? php 
    <div  class='site-logo'>
        <a  href='<? php  echo esc_url(  home_url(  '/' )  ) ; ?>' title='<? php  echo esc_attr(  get_bloginfo(  'name', 'display' )  ) ; ?>' rel='home'><img  src='<? php  echo esc_url(  get_theme_mod(  'myblog_logo' )  ) ; ?>' alt='<? php  echo esc_attr(  get_bloginfo(  'name', 'display' )  ) ; ?>'></a>
    </div >
<? php  }  else { ? >
    <hgroup >
        <h1 class='site-title'><a href='<? php  echo esc_url(  home_url(  '/' )  ) ; ?>' title='<? php  echo esc_attr(  get_bloginfo(  'name', 'display' )  ) ; ?>' rel='home'><? php  bloginfo(  'name' ) ; ?></a ></h1>
        <h2 class='site-description'><? php  bloginfo(  'description' ) ; ?></h2>
    </hgroup >
<? php  }  ? >
No comments:
Post a Comment
Thank You For Comment