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

Commit

Permalink
Custom Logo Optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtakashi committed Mar 24, 2016
1 parent 0b0709a commit afed4a5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
29 changes: 8 additions & 21 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,15 @@ function twentysixteen_setup() {

/*
* Enable support for custom logo.
*
* @since Twenty Sixteen 1.5
*/
add_image_size( 'twentysixteen-logo', 1200, 175 );
add_theme_support( 'custom-logo', array( 'size' => 'twentysixteen-logo' ) );
add_theme_support( 'custom-logo', array(
'height' => 240,
'width' => 240,
'flex-height' => true,
'flex-width' => true,
) );

/*
* Enable support for Post Thumbnails on posts and pages.
Expand Down Expand Up @@ -414,22 +420,3 @@ function twentysixteen_widget_tag_cloud_args( $args ) {
return $args;
}
add_filter( 'widget_tag_cloud_args', 'twentysixteen_widget_tag_cloud_args' );

/**
* Add custom image sizes attribute to enhance responsive image functionality
* for custom logo.
*
* @since Twenty Sixteen 1.2
*
* @param array $attr Attributes for the image markup.
* @param int $attachment Image attachment ID.
* @param array $size Registered image size or flat array of height and width dimensions.
* @return string A source size value for use in a post thumbnail 'sizes' attribute.
*/
function twentysixteen_logo_sizes_attr( $attr, $attachment, $size ) {
if ( 'twentysixteen-logo' === $size ) {
$attr['sizes'] = '(max-width: 709px) 85vw, (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px';
}
return $attr;
}
add_filter( 'wp_get_attachment_image_attributes', 'twentysixteen_logo_sizes_attr', 10 , 3 );
12 changes: 12 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,10 @@ blockquote:after,
display: block;
}

.custom-logo {
max-width: 180px;
}

.site-title {
font-family: Montserrat, "Helvetica Neue", sans-serif;
font-size: 23px;
Expand Down Expand Up @@ -2743,6 +2747,10 @@ p > video {
margin-bottom: 1.3125em;
}

.custom-logo {
max-width: 210px;
}

.site-title {
font-size: 28px;
font-size: 1.75rem;
Expand Down Expand Up @@ -3378,6 +3386,10 @@ p > video {
margin-bottom: 1.75em;
}

.custom-logo {
max-width: 240px;
}

.image-navigation {
margin-bottom: 3.230769231em;
}
Expand Down

0 comments on commit afed4a5

Please sign in to comment.