Skip to content
This repository was archived by the owner on May 23, 2018. It is now read-only.

Commit ba08079

Browse files
committed
Merge pull request #444 from iamtakashi/custom-logo
Custom Logo Optimisation
2 parents 0b0709a + afed4a5 commit ba08079

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

functions.php

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,15 @@ function twentysixteen_setup() {
6666

6767
/*
6868
* Enable support for custom logo.
69+
*
70+
* @since Twenty Sixteen 1.5
6971
*/
70-
add_image_size( 'twentysixteen-logo', 1200, 175 );
71-
add_theme_support( 'custom-logo', array( 'size' => 'twentysixteen-logo' ) );
72+
add_theme_support( 'custom-logo', array(
73+
'height' => 240,
74+
'width' => 240,
75+
'flex-height' => true,
76+
'flex-width' => true,
77+
) );
7278

7379
/*
7480
* Enable support for Post Thumbnails on posts and pages.
@@ -414,22 +420,3 @@ function twentysixteen_widget_tag_cloud_args( $args ) {
414420
return $args;
415421
}
416422
add_filter( 'widget_tag_cloud_args', 'twentysixteen_widget_tag_cloud_args' );
417-
418-
/**
419-
* Add custom image sizes attribute to enhance responsive image functionality
420-
* for custom logo.
421-
*
422-
* @since Twenty Sixteen 1.2
423-
*
424-
* @param array $attr Attributes for the image markup.
425-
* @param int $attachment Image attachment ID.
426-
* @param array $size Registered image size or flat array of height and width dimensions.
427-
* @return string A source size value for use in a post thumbnail 'sizes' attribute.
428-
*/
429-
function twentysixteen_logo_sizes_attr( $attr, $attachment, $size ) {
430-
if ( 'twentysixteen-logo' === $size ) {
431-
$attr['sizes'] = '(max-width: 709px) 85vw, (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px';
432-
}
433-
return $attr;
434-
}
435-
add_filter( 'wp_get_attachment_image_attributes', 'twentysixteen_logo_sizes_attr', 10 , 3 );

style.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,10 @@ blockquote:after,
15651565
display: block;
15661566
}
15671567

1568+
.custom-logo {
1569+
max-width: 180px;
1570+
}
1571+
15681572
.site-title {
15691573
font-family: Montserrat, "Helvetica Neue", sans-serif;
15701574
font-size: 23px;
@@ -2743,6 +2747,10 @@ p > video {
27432747
margin-bottom: 1.3125em;
27442748
}
27452749

2750+
.custom-logo {
2751+
max-width: 210px;
2752+
}
2753+
27462754
.site-title {
27472755
font-size: 28px;
27482756
font-size: 1.75rem;
@@ -3378,6 +3386,10 @@ p > video {
33783386
margin-bottom: 1.75em;
33793387
}
33803388

3389+
.custom-logo {
3390+
max-width: 240px;
3391+
}
3392+
33813393
.image-navigation {
33823394
margin-bottom: 3.230769231em;
33833395
}

0 commit comments

Comments
 (0)