From e414638a7f555dbfa9b756de28d661ea698ecb79 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 18 Apr 2013 17:08:55 +0000 Subject: [PATCH] Twenty Thirteen: Use the_post_format_gallery(). props obenland, fixes #24126. git-svn-id: https://develop.svn.wordpress.org/trunk@24029 602fd350-edb4-49c9-b593-d223f7449a82 --- .../themes/twentythirteen/content-gallery.php | 2 +- .../themes/twentythirteen/functions.php | 26 +++---------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/wp-content/themes/twentythirteen/content-gallery.php b/wp-content/themes/twentythirteen/content-gallery.php index 2d85dbc8e1..e357980eae 100644 --- a/wp-content/themes/twentythirteen/content-gallery.php +++ b/wp-content/themes/twentythirteen/content-gallery.php @@ -24,7 +24,7 @@ →', 'twentythirteen' ) ); ?> '', 'link_before' => '', 'link_after' => '' ) ); ?> - + diff --git a/wp-content/themes/twentythirteen/functions.php b/wp-content/themes/twentythirteen/functions.php index 41065405a0..a0d8cd8f9a 100644 --- a/wp-content/themes/twentythirteen/functions.php +++ b/wp-content/themes/twentythirteen/functions.php @@ -445,39 +445,21 @@ function twentythirteen_get_link_url() { 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. * - * @see twentythirteen_featured_gallery() - * * @since Twenty Thirteen 1.0 * * @param array $atts Combined and filtered attribute list. * @return array */ function twentythirteen_gallery_atts( $atts ) { - $atts['size'] = 'large'; + if ( has_post_format( 'gallery' ) && ! is_single() ) + $atts['size'] = 'large'; + return $atts; } +add_filter( 'shortcode_atts_gallery', 'twentythirteen_gallery_atts' ); /** * Extends the default WordPress body class to denote: