Make WordPress Core

Ticket #24126: 24126.diff

File 24126.diff, 2.2 KB (added by obenland, 13 years ago)
  • wp-content/themes/twentythirteen/content-gallery.php

     
    2424                        <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?>
    2525                        <?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>' ) ); ?>
    2626                <?php else : ?>
    27                         <?php twentythirteen_featured_gallery(); ?>
     27                        <?php the_post_format_gallery(); ?>
    2828                <?php endif; // is_single() ?>
    2929        </div><!-- .entry-content -->
    3030
  • wp-content/themes/twentythirteen/functions.php

     
    445445        return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
    446446}
    447447
    448 if ( ! function_exists( 'twentythirteen_featured_gallery' ) ) :
    449 /**
    450  * Displays first gallery from post content. Changes image size from thumbnail
    451  * to large, to display a larger first image.
    452  *
    453  * @since Twenty Thirteen 1.0
    454  *
    455  * @return void
    456  */
    457 function twentythirteen_featured_gallery() {
    458         $pattern = get_shortcode_regex();
    459 
    460         if ( preg_match( "/$pattern/s", get_the_content(), $match ) && 'gallery' == $match[2] ) {
    461                 add_filter( 'shortcode_atts_gallery', 'twentythirteen_gallery_atts' );
    462                 echo do_shortcode_tag( $match );
    463         }
    464 }
    465 endif;
    466 
    467448/**
    468449 * Sets the image size in featured galleries to large.
    469450 *
    470  * @see twentythirteen_featured_gallery()
    471  *
    472451 * @since Twenty Thirteen 1.0
    473452 *
    474453 * @param array $atts Combined and filtered attribute list.
    475454 * @return array
    476455 */
    477456function twentythirteen_gallery_atts( $atts ) {
    478         $atts['size'] = 'large';
     457        if ( has_post_format( 'gallery' ) && ! is_single() )
     458                $atts['size'] = 'large';
     459
    479460        return $atts;
    480461}
     462add_filter( 'shortcode_atts_gallery', 'twentythirteen_gallery_atts' );
    481463
    482464/**
    483465 * Extends the default WordPress body class to denote: