From a001b8541f63c293eb212b49a96dc240d9b01614 Mon Sep 17 00:00:00 2001 From: Lance Willett Date: Fri, 22 Mar 2013 17:29:19 +0000 Subject: [PATCH] Twenty Thirteen: use gallery shortcode filter for featured galleries, props obenland. Closes #23823. git-svn-id: https://develop.svn.wordpress.org/trunk@23782 602fd350-edb4-49c9-b593-d223f7449a82 --- .../themes/twentythirteen/functions.php | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/wp-content/themes/twentythirteen/functions.php b/wp-content/themes/twentythirteen/functions.php index f34068593e..3035295d3c 100644 --- a/wp-content/themes/twentythirteen/functions.php +++ b/wp-content/themes/twentythirteen/functions.php @@ -447,17 +447,28 @@ if ( ! function_exists( 'twentythirteen_featured_gallery' ) ) : function twentythirteen_featured_gallery() { $pattern = get_shortcode_regex(); - if ( preg_match( "/$pattern/s", get_the_content(), $match ) ) { - if ( 'gallery' == $match[2] ) { - if ( ! strpos( $match[3], 'size' ) ) - $match[3] .= ' size="medium"'; - - echo do_shortcode_tag( $match ); - } + 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'; + return $atts; +} + /** * Extends the default WordPress body class to denote: * 1. Custom fonts enabled.