Make WordPress Core

Ticket #27246: 27246.diff

File 27246.diff, 1.2 KB (added by diddledani, 8 years ago)

Repurpose deprecated argument to optionally indicate a post other than, the current from "The Loop", to excerpt

  • wp-includes/post-template.php

     
    338338 * Display the post excerpt.
    339339 *
    340340 * @since 0.71
     341 *
     342 * @param mixed $post Optional post ID or WP_Post object indicating which post to excerpt.
    341343 */
    342 function the_excerpt() {
     344function the_excerpt( $post = '' ) {
    343345
    344346        /**
    345347         * Filter the displayed post excerpt.
     
    350352         *
    351353         * @param string $post_excerpt The post excerpt.
    352354         */
    353         echo apply_filters( 'the_excerpt', get_the_excerpt() );
     355        echo apply_filters( 'the_excerpt', get_the_excerpt( $post ) );
    354356}
    355357
    356358/**
     
    358360 *
    359361 * @since 0.71
    360362 *
    361  * @param mixed $deprecated Not used.
     363 * @param mixed $post Optional post ID or WP_Post object indicating which post to excerpt.
    362364 * @return string
    363365 */
    364 function get_the_excerpt( $deprecated = '' ) {
    365         if ( !empty( $deprecated ) )
     366function get_the_excerpt( $post = '' ) {
     367        if ( ! empty( $post ) && is_bool( $post ) ) {
    366368                _deprecated_argument( __FUNCTION__, '2.3' );
     369        }
    367370
    368         $post = get_post();
     371        $post = get_post( $post );
    369372        if ( empty( $post ) ) {
    370373                return '';
    371374        }