Make WordPress Core

Ticket #25229: post-thumbnail-template.php.diff

File post-thumbnail-template.php.diff, 2.2 KB (added by NikV, 11 years ago)

First Pass at wp-includes/post-thumbnail-template.php

  • 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         */
    8895        $size = apply_filters( 'post_thumbnail_size', $size );
    8996        if ( $post_thumbnail_id ) {
     97                /**
     98                 * Begins to fetch the post thumbnail HTML.
     99                 *
     100                 * @since 2.9.0
     101                 *
     102                 * @param string $post_id The ID of the post where the post thumbnail will be displayed.
     103                 * @param string $post_thumbnail_id The ID of a post thumbnail.
     104                 * @param string $size The size of a post thumbnail.
     105                 */
    90106                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
    91107                if ( in_the_loop() )
    92108                        update_post_thumbnail_cache();
    93109                $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
     110                /**
     111                 * Stops fetching the post thumbnail HTML.
     112                 *
     113                 * @since 2.9.0
     114                 *
     115                 * @param string $post_id The ID of the post where the post thumbnail will be displayed.
     116                 * @param string $post_thumbnail_id The ID of a post thumbnail.
     117                 * @param string $size The size of a post thumbnail.
     118                 */
    94119                do_action( 'end_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size );
    95120        } else {
    96121                $html = '';
    97122        }
     123        /**
     124         * Filters the post thumbnail HTML.
     125         *
     126         * @since 2.9.0
     127         *
     128         * @param string $html Gets the iamge attachment for the post thumbnail.
     129         * @param string $post_id The ID of the post where the post thumbnail will be displayed.
     130         * @param string $post_thumbnail_id The ID of a post thumbnail.
     131         * @param string $size The size of a post thumbnail.
     132         * @param string $attr Optional. Query string of attributes.
     133         */
    98134        return apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr );
    99135}