Make WordPress Core

Ticket #25229: post-thumbnail-template1.diff

File post-thumbnail-template1.diff, 2.1 KB (added by NikV, 13 years ago)

Second Pass at wp-includes/post-thumbnail-template.php. Thanks @ericlewis

  • wp-includes/post-thumbnail-template.php

     
    8585function get_the_post_thumbnail( $post_id = null, $size = 'post-thumbnail', $attr = '' ) {
    8686        $post_id = ( null === $post_id ) ? get_the_ID() : $post_id;
    8787        $post_thumbnail_id = get_post_thumbnail_id( $post_id );
     88        /**
     89         * Filters the post thumbnail size.
     90         *
     91         * @since 2.9.0
     92         *
     93         * @param string $size The size of a post thumbnail.
     94         * @see get_the_post_thumbnail.
     95         */
    8896        $size = apply_filters( 'post_thumbnail_size', $size );
    8997        if ( $post_thumbnail_id ) {
     98                /**
     99                 * Before fetching the post thumbnail HTML.
     100                 *
     101                 * @since 2.9.0
     102                 *
     103                 * @param string $post_id Post ID.
     104                 * @param string $post_thumbnail_id The post thumbnail ID.
     105                 * @param string $size The size of a post thumbnail.
     106                 */
    90107                do_action( 'begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size ); // for "Just In Time" filtering of all of wp_get_attachment_image()'s filters
    91108                if ( in_the_loop() )
    92109                        update_post_thumbnail_cache();
    93110                $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
     111                /**
     112                 * After fetching the post thumbnail HTML.
     113                 *
     114                 * @since 2.9.0
     115                 *
     116                 * @param string $post_id Post ID.
     117                 * @param string $post_thumbnail_id The post thumbnail ID.
     118                 * @param string $size The size of a post thumbnail.
     119                 */
    94120                do_action( 'end_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size );
    95121        } else {
    96122                $html = '';
    97123        }
     124        /**
     125         * Filters the post thumbnail HTML.
     126         *
     127         * @since 2.9.0
     128         *
     129         * @param string $html Gets the image attachment for the post thumbnail.
     130         * @param string $post_id Post ID.
     131         * @param string $post_thumbnail_id The post thumbnail ID.
     132         * @param string $size The size of a post thumbnail.
     133         * @param string $attr Optional. Query string of attributes.
     134         */
    98135        return apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr );
    99136}