Twenty Thirteen: Use the_post_format_gallery(). props obenland, fixes #24126.

git-svn-id: http://core.svn.wordpress.org/trunk@24029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-04-18 17:08:55 +00:00
parent ef3d64ccd9
commit 68d29b46c5
2 changed files with 5 additions and 23 deletions

View File

@ -24,7 +24,7 @@
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
<?php else : ?> <?php else : ?>
<?php twentythirteen_featured_gallery(); ?> <?php the_post_format_gallery(); ?>
<?php endif; // is_single() ?> <?php endif; // is_single() ?>
</div><!-- .entry-content --> </div><!-- .entry-content -->

View File

@ -445,39 +445,21 @@ function twentythirteen_get_link_url() {
return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
} }
if ( ! function_exists( 'twentythirteen_featured_gallery' ) ) :
/**
* Displays first gallery from post content. Changes image size from thumbnail
* to large, to display a larger first image.
*
* @since Twenty Thirteen 1.0
*
* @return void
*/
function twentythirteen_featured_gallery() {
$pattern = get_shortcode_regex();
if ( preg_match( "/$pattern/s", get_the_content(), $match ) && 'gallery' == $match[2] ) {
add_filter( 'shortcode_atts_gallery', 'twentythirteen_gallery_atts' );
echo do_shortcode_tag( $match );
}
}
endif;
/** /**
* Sets the image size in featured galleries to large. * Sets the image size in featured galleries to large.
* *
* @see twentythirteen_featured_gallery()
*
* @since Twenty Thirteen 1.0 * @since Twenty Thirteen 1.0
* *
* @param array $atts Combined and filtered attribute list. * @param array $atts Combined and filtered attribute list.
* @return array * @return array
*/ */
function twentythirteen_gallery_atts( $atts ) { function twentythirteen_gallery_atts( $atts ) {
if ( has_post_format( 'gallery' ) && ! is_single() )
$atts['size'] = 'large'; $atts['size'] = 'large';
return $atts; return $atts;
} }
add_filter( 'shortcode_atts_gallery', 'twentythirteen_gallery_atts' );
/** /**
* Extends the default WordPress body class to denote: * Extends the default WordPress body class to denote: