WordPress.org

Make WordPress Core

Ticket #14402: 14402.refreshed-2.diff

File 14402.refreshed-2.diff, 1.9 KB (added by lancewillett, 7 years ago)
  • wp-content/themes/twentyten/loop-attachment.php

     
    8686        }
    8787?>
    8888                                                <p class="attachment"><a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
    89                                                         $attachment_size = apply_filters( 'twentyten_attachment_size', 900 );
    90                                                         echo wp_get_attachment_image( $post->ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height.
     89                                                        $attachment_size = twentyten_attachment_sizes(); // filterable image height and width
     90                                                        echo wp_get_attachment_image( $post->ID, array( $attachment_size['width'], $attachment_size['height'] ) );
    9191                                                ?></a></p>
    9292
    9393                                                <div id="nav-below" class="navigation">
  • wp-content/themes/twentyten/functions.php

     
    499499        );
    500500}
    501501endif;
     502
     503if ( ! function_exists( 'twentyten_attachment_sizes' ) ) :
     504/**
     505 * Filterable attachment width and height, defaults to 900px for both measurements
     506 *
     507 * For backwards compatibility uses the width value from attachment_size_width filter if it exists
     508 *
     509 * @uses twentyten_attachment_size filter
     510 * @return array
     511 *
     512 * @since Twenty Ten 3.1
     513 */
     514function twentyten_attachment_sizes() {
     515        $attachment_size_width = apply_filters( 'twentyten_attachment_size', 900 ); // apply old filter first
     516        $attachment_sizes = apply_filters( 'twentyten_attachment_sizes', array( 'width' => $attachment_size_width, 'height' => 900 ) );
     517
     518        return $attachment_sizes;
     519}
     520endif;
     521 No newline at end of file