MENU

WordPress Custom Logo

function themename_custom_logo_setup() {
$defaults = array(
'height' => 100,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
);
add_theme_support( 'custom-logo', $defaults );
}
add_action( 'after_setup_theme', 'themename_custom_logo_setup' );

if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
}

$custom_logo_id = get_theme_mod( 'custom_logo' );
$logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
if ( has_custom_logo() ) {
echo '';
} else {
echo '

'. get_bloginfo( 'name' ) .'

';
}

Tags: header, logo, php, wordPress,

0 Comment