Twenty Thirteen: use gallery shortcode filter for featured galleries, props obenland. Closes #23823.

git-svn-id: http://core.svn.wordpress.org/trunk@23782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-03-22 17:29:19 +00:00
parent 0352ffb565
commit e1e654517a
1 changed files with 18 additions and 7 deletions

View File

@ -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.