mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Twenty Fourteen: better logic for featured image HTML output, and add fallback message for focusable anchor elements, for accessibility. Fixes #25325.
Built from https://develop.svn.wordpress.org/trunk@25802 git-svn-id: http://core.svn.wordpress.org/trunk@25714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4542fbb2ae
commit
f98e6f60fb
@ -9,7 +9,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<?php twentyfourteen_featured_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
|
@ -25,12 +25,12 @@ endif;
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<?php if( is_single() && $image ) : ?>
|
<?php if ( is_single() && $image ) : ?>
|
||||||
<div class="attachment-featured-thumbnail">
|
<div class="featured-thumbnail">
|
||||||
<?php echo wp_get_attachment_image( $image, 'featured-thumbnail-large' ); ?>
|
<?php echo wp_get_attachment_image( $image, 'featured-thumbnail-large' ); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ( $image ) : ?>
|
<?php elseif ( $image ) : ?>
|
||||||
<a class="attachment-featured-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
|
<a class="featured-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
|
||||||
<?php echo wp_get_attachment_image( $image, 'featured-thumbnail-large' ); ?>
|
<?php echo wp_get_attachment_image( $image, 'featured-thumbnail-large' ); ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<?php twentyfourteen_featured_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<?php twentyfourteen_featured_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<?php twentyfourteen_featured_thumbnail(); ?>
|
<?php
|
||||||
|
twentyfourteen_post_thumbnail();
|
||||||
<?php the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></header><!-- .entry-header -->' ); ?>
|
the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></header><!-- .entry-header -->' );
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="entry-content">
|
<div class="entry-content">
|
||||||
<?php
|
<?php
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<?php twentyfourteen_featured_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<?php twentyfourteen_featured_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||||
<?php twentyfourteen_featured_thumbnail(); ?>
|
<?php twentyfourteen_post_thumbnail(); ?>
|
||||||
|
|
||||||
<header class="entry-header">
|
<header class="entry-header">
|
||||||
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
|
||||||
|
@ -18,7 +18,7 @@ function twentyfourteen_customize_register( $wp_customize ) {
|
|||||||
// Add postMessage support for site title and description.
|
// Add postMessage support for site title and description.
|
||||||
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
||||||
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
|
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
|
||||||
|
|
||||||
// Add the custom accent color setting and control.
|
// Add the custom accent color setting and control.
|
||||||
$wp_customize->add_setting( 'accent_color', array(
|
$wp_customize->add_setting( 'accent_color', array(
|
||||||
'default' => '#24890d',
|
'default' => '#24890d',
|
||||||
|
@ -155,26 +155,31 @@ add_action( 'edit_category', 'twentyfourteen_category_transient_flusher' );
|
|||||||
add_action( 'save_post', 'twentyfourteen_category_transient_flusher' );
|
add_action( 'save_post', 'twentyfourteen_category_transient_flusher' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display featured image with appropriate HTML tag.
|
* Displays an optional featured image, with an anchor element
|
||||||
*
|
* when on index views, and a div element when on a single view.
|
||||||
* @since Twenty Fourteen 1.0
|
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function twentyfourteen_featured_thumbnail() {
|
function twentyfourteen_post_thumbnail() {
|
||||||
if ( ! post_password_required() ) :
|
if ( post_password_required() )
|
||||||
if ( has_post_thumbnail() && is_singular() ) :
|
return;
|
||||||
?>
|
|
||||||
<div class="attachment-featured-thumbnail">
|
if ( is_singular() ) :
|
||||||
<?php the_post_thumbnail( 'featured-thumbnail-large' ); ?>
|
?>
|
||||||
</div>
|
|
||||||
<?php
|
<div class="featured-thumbnail">
|
||||||
else :
|
<?php the_post_thumbnail( 'featured-thumbnail-large' ); ?>
|
||||||
?>
|
</div>
|
||||||
<a href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>" class="attachment-featured-thumbnail">
|
|
||||||
<?php the_post_thumbnail( 'featured-thumbnail-large' ); ?>
|
<?php else : ?>
|
||||||
</a>
|
|
||||||
<?php
|
<a class="featured-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
|
||||||
endif;
|
<?php if ( has_post_thumbnail() ) :
|
||||||
endif;
|
the_post_thumbnail( 'featured-thumbnail-large' );
|
||||||
}
|
else : ?>
|
||||||
|
<p class="screen-reader-text"><?php _e( 'No featured image.', 'twentyfourteen' ); ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<?php endif; // End is_singular()
|
||||||
|
}
|
||||||
|
@ -367,7 +367,7 @@ blockquote.alignleft {
|
|||||||
|
|
||||||
/* Mobile list style */
|
/* Mobile list style */
|
||||||
@media screen and (max-width: 400px) {
|
@media screen and (max-width: 400px) {
|
||||||
.list-view .attachment-featured-thumbnail img {
|
.list-view .featured-thumbnail img {
|
||||||
float: right;
|
float: right;
|
||||||
margin: 0 0 3px 10px;
|
margin: 0 0 3px 10px;
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ img.wp-post-image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.attachment-featured-featured img,
|
.attachment-featured-featured img,
|
||||||
.attachment-featured-thumbnail img {
|
.featured-thumbnail img {
|
||||||
height: auto;
|
height: auto;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
@ -1107,7 +1107,7 @@ span + .edit-link:before,
|
|||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.attachment-featured-thumbnail {
|
.featured-thumbnail {
|
||||||
background: #767676;
|
background: #767676;
|
||||||
background-attachment: fixed;
|
background-attachment: fixed;
|
||||||
background-image: -webkit-linear-gradient(135deg, #767676 12.5%, #fff 12.5%, #fff 50%, #767676 50%, #767676 62.5%, #fff 62.5%);
|
background-image: -webkit-linear-gradient(135deg, #767676 12.5%, #fff 12.5%, #fff 50%, #767676 50%, #767676 62.5%, #fff 62.5%);
|
||||||
@ -1123,7 +1123,7 @@ span + .edit-link:before,
|
|||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.attachment-featured-thumbnail:hover {
|
.featured-thumbnail:hover {
|
||||||
background: #919191;
|
background: #919191;
|
||||||
background-attachment: fixed;
|
background-attachment: fixed;
|
||||||
background-image: -webkit-linear-gradient(135deg, #919191 12.5%, #fff 12.5%, #fff 50%, #919191 50%, #919191 62.5%, #fff 62.5%);
|
background-image: -webkit-linear-gradient(135deg, #919191 12.5%, #fff 12.5%, #fff 50%, #919191 50%, #919191 62.5%, #fff 62.5%);
|
||||||
@ -1131,13 +1131,13 @@ span + .edit-link:before,
|
|||||||
background-size: 4px 4px;
|
background-size: 4px 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.attachment-featured-thumbnail img {
|
.featured-thumbnail img {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.has-featured-image .attachment-featured-thumbnail,
|
.has-featured-image .featured-thumbnail,
|
||||||
.format-standard .attachment-featured-thumbnail {
|
.format-standard .featured-thumbnail {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2637,14 +2637,14 @@ span + .edit-link:before,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@media screen and (max-width: 400px) {
|
@media screen and (max-width: 400px) {
|
||||||
.list-view .attachment-featured-thumbnail {
|
.list-view .featured-thumbnail {
|
||||||
background: none;
|
background: none;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
width: auto;
|
width: auto;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-view .attachment-featured-thumbnail img {
|
.list-view .featured-thumbnail img {
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0 10px 3px 0;
|
margin: 0 10px 3px 0;
|
||||||
width: 84px;
|
width: 84px;
|
||||||
@ -2707,7 +2707,7 @@ span + .edit-link:before,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 401px) {
|
@media screen and (min-width: 401px) {
|
||||||
a.attachment-featured-thumbnail:hover img {
|
a.featured-thumbnail:hover img {
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2809,8 +2809,8 @@ span + .edit-link:before,
|
|||||||
margin: -3px 2px 0 0;
|
margin: -3px 2px 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-view .site-content .has-featured-image .attachment-featured-thumbnail,
|
.list-view .site-content .has-featured-image .featured-thumbnail,
|
||||||
.list-view .site-content .format-standard .attachment-featured-thumbnail {
|
.list-view .site-content .format-standard .featured-thumbnail {
|
||||||
margin-top: -49px;
|
margin-top: -49px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user