WordPress.org

Make WordPress Core

Changeset 23782


Ignore:
Timestamp:
03/22/2013 05:29:19 PM (5 years ago)
Author:
lancewillett
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentythirteen/functions.php

    r23696 r23782  
    448448    $pattern = get_shortcode_regex();
    449449
    450     if ( preg_match( "/$pattern/s", get_the_content(), $match ) ) {
    451         if ( 'gallery' == $match[2] ) {
    452             if ( ! strpos( $match[3], 'size' ) )
    453                 $match[3] .= ' size="medium"';
    454 
    455             echo do_shortcode_tag( $match );
    456         }
     450    if ( preg_match( "/$pattern/s", get_the_content(), $match ) && 'gallery' == $match[2] ) {
     451        add_filter( 'shortcode_atts_gallery', 'twentythirteen_gallery_atts' );
     452        echo do_shortcode_tag( $match );
    457453    }
    458454}
    459455endif;
     456
     457/**
     458 * Sets the image size in featured galleries to large.
     459 *
     460 * @see twentythirteen_featured_gallery()
     461 *
     462 * @since Twenty Thirteen 1.0
     463 *
     464 * @param array $atts Combined and filtered attribute list.
     465 * @return array
     466 */
     467function twentythirteen_gallery_atts( $atts ) {
     468    $atts['size'] = 'large';
     469    return $atts;
     470}
    460471
    461472/**
Note: See TracChangeset for help on using the changeset viewer.