Twenty Fifteen: add support for site logos

Fixes #35944
Props @iamtakashi, @celloexpressions, @drebbits.web


git-svn-id: https://develop.svn.wordpress.org/trunk@36913 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tammie 2016-03-09 23:01:53 +00:00
parent c1c6def489
commit b37bfd8e29
4 changed files with 68 additions and 0 deletions

View File

@ -103,6 +103,14 @@ function twentyfifteen_setup() {
'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'
) );
/*
* Enable support for custom logo.
*
* @since Twenty Fifteen 1.5
*/
add_image_size( 'twentyfifteen-logo', 248, 248 );
add_theme_support( 'custom-logo', array( 'size' => 'twentyfifteen-logo' ) );
$color_scheme = twentyfifteen_get_color_scheme();
$default_color = trim( $color_scheme[0], '#' );

View File

@ -29,6 +29,8 @@
<header id="masthead" class="site-header" role="banner">
<div class="site-branding">
<?php
twentyfifteen_the_custom_logo();
if ( is_front_page() && is_home() ) : ?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php else : ?>

View File

@ -241,3 +241,20 @@ function twentyfifteen_excerpt_more( $more ) {
}
add_filter( 'excerpt_more', 'twentyfifteen_excerpt_more' );
endif;
if ( ! function_exists( 'twentyfifteen_the_custom_logo' ) ) :
/**
* Displays the optional custom logo.
*
* Returns early if the custom logo is not available.
*
* @since Twenty Fifteen 1.5
*/
function twentyfifteen_the_custom_logo() {
if ( ! function_exists( 'the_custom_logo' ) ) {
return;
} else {
the_custom_logo();
}
}
endif;

View File

@ -1316,6 +1316,15 @@ img.aligncenter {
margin-bottom: 0;
}
.custom-logo {
max-height: 84px;
width: auto;
}
.wp-custom-logo .site-title {
margin-top: 0.545454545em;
}
.site-description {
display: none;
font-family: "Noto Sans", sans-serif;
@ -3089,6 +3098,14 @@ p > video {
line-height: 1.2069;
}
.custom-logo {
max-height: 105px;
}
.wp-custom-logo .site-title {
margin-top: 0.482758621em;
}
.site-description {
font-size: 14px;
font-size: 1.4rem;
@ -3711,6 +3728,14 @@ p > video {
line-height: 1.25;
}
.custom-logo {
max-height: 104px;
}
.wp-custom-logo .site-title {
margin-top: 0.5em;
}
.site-description {
font-size: 16px;
font-size: 1.6rem;
@ -4346,6 +4371,14 @@ p > video {
line-height: 1.3636;
}
.custom-logo {
max-height: none;
}
.wp-custom-logo .site-title {
margin-top: 0.545454545em;
}
.site-description {
font-size: 12px;
font-size: 1.2rem;
@ -4965,6 +4998,10 @@ p > video {
line-height: 1.1667;
}
.wp-custom-logo .site-title {
margin-top: 0.583333333em;
}
.site-description {
font-size: 14px;
font-size: 1.4rem;
@ -5503,6 +5540,10 @@ p > video {
line-height: 1.1852;
}
.wp-custom-logo .site-title {
margin-top: 0.592592593em;
}
.site-description {
font-size: 16px;
font-size: 1.6rem;