Twenty Fourteen: clean up post thumbnail naming. Props iamtakashi, fixes #25718.
git-svn-id: https://develop.svn.wordpress.org/trunk@25971 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
01a703070b
commit
eb01af41c2
@ -12,7 +12,7 @@
|
|||||||
<a class="attachment-featured-featured" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
|
<a class="attachment-featured-featured" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
|
||||||
<?php
|
<?php
|
||||||
if ( has_post_thumbnail() ) :
|
if ( has_post_thumbnail() ) :
|
||||||
the_post_thumbnail( 'featured-thumbnail-featured' );
|
the_post_thumbnail( 'post-thumbnail-grid' );
|
||||||
|
|
||||||
else :
|
else :
|
||||||
$images = get_children( array(
|
$images = get_children( array(
|
||||||
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
if ( $images ) :
|
if ( $images ) :
|
||||||
$image = array_shift( $images );
|
$image = array_shift( $images );
|
||||||
echo wp_get_attachment_image( $image->ID, 'featured-thumbnail-featured' );
|
echo wp_get_attachment_image( $image->ID, 'post-thumbnail-grid' );
|
||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
|
@ -68,9 +68,8 @@ function twentyfourteen_setup() {
|
|||||||
add_theme_support( 'post-thumbnails' );
|
add_theme_support( 'post-thumbnails' );
|
||||||
|
|
||||||
// Add several sizes for Post Thumbnails.
|
// Add several sizes for Post Thumbnails.
|
||||||
add_image_size( 'featured-thumbnail-large', 672, 0 );
|
add_image_size( 'post-thumbnail-grid', 672, 372, true );
|
||||||
add_image_size( 'featured-thumbnail-featured', 672, 372, true );
|
add_image_size( 'post-thumbnail', 672, 0 );
|
||||||
add_image_size( 'featured-thumbnail-formatted', 306, 0 );
|
|
||||||
|
|
||||||
// This theme uses wp_nav_menu() in two locations.
|
// This theme uses wp_nav_menu() in two locations.
|
||||||
register_nav_menus( array(
|
register_nav_menus( array(
|
||||||
@ -361,9 +360,11 @@ endif;
|
|||||||
*
|
*
|
||||||
* Adds body classes to denote:
|
* Adds body classes to denote:
|
||||||
* 1. Single or multiple authors.
|
* 1. Single or multiple authors.
|
||||||
* 2. Index views.
|
* 2. Presense of header image.
|
||||||
* 3. Full-width content layout.
|
* 3. Index views.
|
||||||
* 4. Presence of footer widgets.
|
* 4. Full-width content layout.
|
||||||
|
* 5. Presence of footer widgets.
|
||||||
|
* 6. Single views.
|
||||||
*
|
*
|
||||||
* @since Twenty Fourteen 1.0
|
* @since Twenty Fourteen 1.0
|
||||||
*
|
*
|
||||||
@ -391,6 +392,9 @@ function twentyfourteen_body_classes( $classes ) {
|
|||||||
if ( is_active_sidebar( 'sidebar-3' ) )
|
if ( is_active_sidebar( 'sidebar-3' ) )
|
||||||
$classes[] = 'footer-widgets';
|
$classes[] = 'footer-widgets';
|
||||||
|
|
||||||
|
if ( is_singular() )
|
||||||
|
$classes[] = 'singular';
|
||||||
|
|
||||||
return $classes;
|
return $classes;
|
||||||
}
|
}
|
||||||
add_filter( 'body_class', 'twentyfourteen_body_classes' );
|
add_filter( 'body_class', 'twentyfourteen_body_classes' );
|
||||||
@ -399,7 +403,7 @@ add_filter( 'body_class', 'twentyfourteen_body_classes' );
|
|||||||
* Extend the default WordPress post classes.
|
* Extend the default WordPress post classes.
|
||||||
*
|
*
|
||||||
* Adds a post class to denote:
|
* Adds a post class to denote:
|
||||||
* Non-password protected page with a featured image.
|
* Non-password protected page with a post thumbnail.
|
||||||
*
|
*
|
||||||
* @since Twenty Fourteen 1.0
|
* @since Twenty Fourteen 1.0
|
||||||
*
|
*
|
||||||
@ -408,7 +412,9 @@ add_filter( 'body_class', 'twentyfourteen_body_classes' );
|
|||||||
*/
|
*/
|
||||||
function twentyfourteen_post_classes( $classes ) {
|
function twentyfourteen_post_classes( $classes ) {
|
||||||
if ( ! post_password_required() && has_post_thumbnail() )
|
if ( ! post_password_required() && has_post_thumbnail() )
|
||||||
$classes[] = 'has-featured-image';
|
$classes[] = 'has-post-thumbnail';
|
||||||
|
else
|
||||||
|
$classes[] = 'no-post-thumbnail';
|
||||||
|
|
||||||
return $classes;
|
return $classes;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ add_action( 'edit_category', 'twentyfourteen_category_transient_flusher' );
|
|||||||
add_action( 'save_post', 'twentyfourteen_category_transient_flusher' );
|
add_action( 'save_post', 'twentyfourteen_category_transient_flusher' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays an optional featured image, with an anchor element
|
* Displays an optional post thumbnail, with an anchor element
|
||||||
* when on index views, and a div element when on a single view.
|
* when on index views, and a div element when on a single view.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@ -171,15 +171,15 @@ function twentyfourteen_post_thumbnail() {
|
|||||||
if ( is_singular() ) :
|
if ( is_singular() ) :
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="featured-thumbnail">
|
<div class="post-thumbnail">
|
||||||
<?php the_post_thumbnail( 'featured-thumbnail-large' ); ?>
|
<?php the_post_thumbnail( 'post-thumbnail' ); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
|
||||||
<a class="featured-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
|
<a class="post-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
|
||||||
<?php if ( has_post_thumbnail() ) :
|
<?php if ( has_post_thumbnail() ) :
|
||||||
the_post_thumbnail( 'featured-thumbnail-large' );
|
the_post_thumbnail( 'post-thumbnail' );
|
||||||
else : ?>
|
else : ?>
|
||||||
<p class="screen-reader-text"><?php _e( 'No featured image.', 'twentyfourteen' ); ?></p>
|
<p class="screen-reader-text"><?php _e( 'No featured image.', 'twentyfourteen' ); ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -361,7 +361,7 @@ blockquote.alignleft {
|
|||||||
|
|
||||||
/* Mobile list style */
|
/* Mobile list style */
|
||||||
@media screen and (max-width: 400px) {
|
@media screen and (max-width: 400px) {
|
||||||
.list-view .featured-thumbnail img {
|
.list-view .post-thumbnail img {
|
||||||
float: right;
|
float: right;
|
||||||
margin: 0 0 3px 10px;
|
margin: 0 0 3px 10px;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ Use it to make something cool, have fun, and share what you've learned with othe
|
|||||||
* 6.9 - Contributor Page
|
* 6.9 - Contributor Page
|
||||||
* 6.10 - 404 Page
|
* 6.10 - 404 Page
|
||||||
* 6.11 - Front Page
|
* 6.11 - Front Page
|
||||||
* 6.12 - Comments
|
* 6.12 - Full-width
|
||||||
|
* 6.13 - Comments
|
||||||
* 7.0 - Sidebar
|
* 7.0 - Sidebar
|
||||||
* 7.1 - Widgets
|
* 7.1 - Widgets
|
||||||
* 7.2 - Content Sidebar Widgets
|
* 7.2 - Content Sidebar Widgets
|
||||||
@ -561,7 +562,7 @@ img.wp-post-image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.attachment-featured-featured img,
|
.attachment-featured-featured img,
|
||||||
.featured-thumbnail img {
|
.post-thumbnail img {
|
||||||
height: auto;
|
height: auto;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
@ -984,10 +985,6 @@ span + .edit-link:before,
|
|||||||
max-width: 672px;
|
max-width: 672px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.full-width .hentry {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.site-content .entry-header,
|
.site-content .entry-header,
|
||||||
.site-content .entry-content,
|
.site-content .entry-content,
|
||||||
.site-content .entry-summary,
|
.site-content .entry-summary,
|
||||||
@ -1003,7 +1000,7 @@ span + .edit-link:before,
|
|||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.featured-thumbnail {
|
.post-thumbnail {
|
||||||
background: url(images/pattern-light.svg) #767676 repeat fixed;
|
background: url(images/pattern-light.svg) #767676 repeat fixed;
|
||||||
display: none;
|
display: none;
|
||||||
float: none;
|
float: none;
|
||||||
@ -1015,17 +1012,17 @@ span + .edit-link:before,
|
|||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.featured-thumbnail:hover {
|
a.post-thumbnail:hover {
|
||||||
background: url(images/pattern-light.svg) #919191 repeat fixed;
|
background: url(images/pattern-light.svg) #919191 repeat fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.featured-thumbnail img {
|
.post-thumbnail img {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.has-featured-image .featured-thumbnail,
|
.has-post-thumbnail .post-thumbnail,
|
||||||
.format-standard .featured-thumbnail {
|
.format-standard .post-thumbnail {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1045,7 +1042,7 @@ a.featured-thumbnail:hover {
|
|||||||
padding: 0 10px 12px;
|
padding: 0 10px 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-content .has-featured-image .entry-header,
|
.site-content .has-post-thumbnail .entry-header,
|
||||||
.site-content .format-standard .entry-header {
|
.site-content .format-standard .entry-header {
|
||||||
padding-top: 24px;
|
padding-top: 24px;
|
||||||
}
|
}
|
||||||
@ -1732,7 +1729,30 @@ a.featured-thumbnail:hover {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 6.11 Comments
|
* 6.12 Full-width
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
.full-width.singular .content-area {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-width .hentry {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-width.singular .hentry.no-post-thumbnail,
|
||||||
|
.full-width.singular .hentry.no-post-thumbnail.format-standard.post-password-required {
|
||||||
|
padding-top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-width.singular .hentry.no-post-thumbnail.format-standard {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6.13 Comments
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -2519,14 +2539,14 @@ a.featured-thumbnail:hover {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@media screen and (max-width: 400px) {
|
@media screen and (max-width: 400px) {
|
||||||
.list-view .featured-thumbnail {
|
.list-view .post-thumbnail {
|
||||||
background: none;
|
background: none;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
width: auto;
|
width: auto;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-view .featured-thumbnail img {
|
.list-view .post-thumbnail img {
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0 10px 3px 0;
|
margin: 0 10px 3px 0;
|
||||||
width: 84px;
|
width: 84px;
|
||||||
@ -2589,7 +2609,7 @@ a.featured-thumbnail:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 401px) {
|
@media screen and (min-width: 401px) {
|
||||||
a.featured-thumbnail:hover img {
|
a.post-thumbnail:hover img {
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2691,8 +2711,8 @@ a.featured-thumbnail:hover {
|
|||||||
margin: -3px 2px 0 0;
|
margin: -3px 2px 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-view .site-content .has-featured-image .featured-thumbnail,
|
.list-view .site-content .has-post-thumbnail .post-thumbnail,
|
||||||
.list-view .site-content .format-standard .featured-thumbnail {
|
.list-view .site-content .format-standard .post-thumbnail {
|
||||||
margin-top: -49px;
|
margin-top: -49px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2714,7 +2734,7 @@ a.featured-thumbnail:hover {
|
|||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-content .has-featured-image .entry-header,
|
.site-content .has-post-thumbnail .entry-header,
|
||||||
.site-content .format-standard .entry-header {
|
.site-content .format-standard .entry-header {
|
||||||
margin-top: -48px;
|
margin-top: -48px;
|
||||||
}
|
}
|
||||||
@ -2731,6 +2751,10 @@ a.featured-thumbnail:hover {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.full-width.singular .content-area {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.site-content {
|
.site-content {
|
||||||
margin-right: 33.33333333%;
|
margin-right: 33.33333333%;
|
||||||
}
|
}
|
||||||
@ -2739,16 +2763,25 @@ a.featured-thumbnail:hover {
|
|||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-content .has-featured-image .entry-header,
|
.site-content .has-post-thumbnail .entry-header,
|
||||||
.site-content .format-standard .entry-header {
|
.site-content .format-standard .entry-header {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.full-width .site-content .has-featured-image .entry-header,
|
.full-width .site-content .has-post-thumbnail .entry-header,
|
||||||
.full-width .site-content .format-standard .entry-header {
|
.full-width .site-content .format-standard .entry-header {
|
||||||
margin-top: -48px;
|
margin-top: -48px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.full-width.singular .hentry.no-post-thumbnail,
|
||||||
|
.full-width.singular .hentry.no-post-thumbnail.format-standard.post-password-required {
|
||||||
|
padding-top: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-width.singular .hentry.no-post-thumbnail.format-standard {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.archive-header,
|
.archive-header,
|
||||||
.comments-area,
|
.comments-area,
|
||||||
.image-navigation,
|
.image-navigation,
|
||||||
@ -2971,7 +3004,20 @@ a.featured-thumbnail:hover {
|
|||||||
padding-top: 72px;
|
padding-top: 72px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-content .has-featured-image .entry-header,
|
.full-width.singular .content-area {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-width.singular .hentry.no-post-thumbnail,
|
||||||
|
.full-width.singular .hentry.no-post-thumbnail.format-standard.post-password-required {
|
||||||
|
padding-top: 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-width.singular .hentry.no-post-thumbnail.format-standard {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-content .has-post-thumbnail .entry-header,
|
||||||
.site-content .format-standard .entry-header {
|
.site-content .format-standard .entry-header {
|
||||||
margin-top: -48px;
|
margin-top: -48px;
|
||||||
}
|
}
|
||||||
@ -3030,7 +3076,7 @@ a.featured-thumbnail:hover {
|
|||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-content .has-featured-image .entry-header,
|
.site-content .has-post-thumbnail .entry-header,
|
||||||
.site-content .format-standard .entry-header {
|
.site-content .format-standard .entry-header {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
@ -3191,7 +3237,7 @@ a.featured-thumbnail:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 1040px) {
|
@media screen and (min-width: 1040px) {
|
||||||
.site-content .has-featured-image .entry-header,
|
.site-content .has-post-thumbnail .entry-header,
|
||||||
.site-content .format-standard .entry-header {
|
.site-content .format-standard .entry-header {
|
||||||
margin-top: -48px;
|
margin-top: -48px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user