Make WordPress Core

Ticket #29014: post-template.php.patch

File post-template.php.patch, 4.8 KB (added by Funkatronic, 11 years ago)
  • post-template.php

     
    4141 * @return null|string Null on no title. String if $echo parameter is false.
    4242 */
    4343function the_title($before = '', $after = '', $echo = true) {
     44        $post = get_post();
    4445        $title = get_the_title();
    4546
    4647        if ( strlen($title) == 0 )
     
    4849
    4950        $title = $before . $title . $after;
    5051
     52        /**
     53         * Filter the displayed post title.
     54         *
     55         * @since 0.72
     56         *
     57         * @param string $post_title The post title.
     58         * @param int    $poat_id The post id.
     59         */
     60        $title = apply_filters( 'the_title', $title, $post->ID );
     61       
     62        /**
     63         * Filter the displayed post title for a custom post type.
     64         *
     65         * @since 4.0
     66         *
     67         * @param string $post_title The post title.
     68         * @param int    $poat_id The post id.
     69         */
     70        $title = apply_filters( "the_title_{$post->post_type}", $title, $post->ID );
     71
    5172        if ( $echo )
    5273                echo $title;
    5374        else
     
    149170        }
    150171
    151172        /**
    152          * Filter the post title.
     173         * Filter the retrieved post title.
    153174         *
    154          * @since 0.71
     175         * @since 4.0
    155176         *
    156          * @param string $title The post title.
    157          * @param int    $id    The post ID.
     177         * @param string $post_title The post title.
     178         * @param int    $poat_id The post id.
    158179         */
    159         return apply_filters( 'the_title', $title, $id );
     180        $title = apply_filters( 'get_the_title', $title, $post->ID );
     181       
     182        /**
     183         * Filter the retrieved post title for a custom post type.
     184         *
     185         * @since 4.0
     186         *
     187         * @param string $post_title The post title.
     188         * @param int    $poat_id The post id.
     189         */
     190        $title = apply_filters( "get_the_title_{$post->post_type}", $title, $post->ID );
     191
     192        return $title;
    160193}
    161194
    162195/**
     
    210243 * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false.
    211244 */
    212245function the_content( $more_link_text = null, $strip_teaser = false) {
     246        $post = get_post();
    213247        $content = get_the_content( $more_link_text, $strip_teaser );
    214248
    215249        /**
    216          * Filter the post content.
     250         * Filter the displayed post content.
    217251         *
    218252         * @since 0.71
    219253         *
    220          * @param string $content Content of the current post.
     254         * @param string $post_content The post content.
     255         * @param int    $poat_id The post id.
    221256         */
    222         $content = apply_filters( 'the_content', $content );
     257        $content = apply_filters( 'the_content', $content, $post->ID );
     258       
     259        /**
     260         * Filter the displayed post content for a custom post type.
     261         *
     262         * @since 4.0
     263         *
     264         * @param string $post_content The post content.
     265         * @param int    $poat_id The post id.
     266         */
     267        $content = apply_filters( "the_content_{$post->post_type}", $content, $post->ID );
    223268        $content = str_replace( ']]>', ']]>', $content );
    224269        echo $content;
    225270}
     
    294339        if ( $preview ) // preview fix for javascript bug with foreign languages
    295340                $output =       preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output );
    296341
     342        /**
     343         * Filter the retrieved post content.
     344         *
     345         * @since 4.0
     346         *
     347         * @param string $post_content The post content.
     348         * @param int    $poat_id The post id.
     349         */
     350        $output = apply_filters( 'get_the_content', $output, $post->ID );
     351       
     352        /**
     353         * Filter the retrieved post content for a custom post type.
     354         *
     355         * @since 4.0
     356         *
     357         * @param string $post_content The post content.
     358         * @param int    $poat_id The post id.
     359         */
     360        $output = apply_filters( "get_the_content_{$post->post_type}", $output, $post->ID );
     361
    297362        return $output;
    298363}
    299364
     
    315380 * @since 0.71
    316381 */
    317382function the_excerpt() {
     383        $post = get_post();
    318384
    319385        /**
    320386         * Filter the displayed post excerpt.
    321387         *
    322          * @since 0.71
     388         * @since 1.2.0
    323389         *
    324          * @see get_the_excerpt()
     390         * @param string $post_excerpt The post excerpt.
     391         * @param int    $poat_id The post id.
     392         */
     393        $excerpt = apply_filters( 'the_excerpt', get_the_excerpt(), $post->ID );
     394       
     395        /**
     396         * Filter the displayed post excerpt for a custom post type.
    325397         *
     398         * @since 4.0
     399         *
    326400         * @param string $post_excerpt The post excerpt.
     401         * @param int    $poat_id The post id.
    327402         */
    328         echo apply_filters( 'the_excerpt', get_the_excerpt() );
     403        $excerpt = apply_filters( "the_excerpt_{$post->post_type}", get_the_excerpt(), $post->ID );
     404
     405        echo $excerpt;
    329406}
    330407
    331408/**
     
    355432         * @since 1.2.0
    356433         *
    357434         * @param string $post_excerpt The post excerpt.
     435         * @param int    $poat_id The post id.
    358436         */
    359         return apply_filters( 'get_the_excerpt', $post->post_excerpt );
     437        $excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt, $post->ID );
     438       
     439        /**
     440         * Filter the retrieved post excerpt for a custom post type.
     441         *
     442         * @since 4.0
     443         *
     444         * @param string $post_excerpt The post excerpt.
     445         * @param int    $poat_id The post id.
     446         */
     447        $excerpt = apply_filters( "get_the_excerpt_{$post->post_type}", $post->post_excerpt, $post->ID );
     448       
     449        return $excerpt;
    360450}
    361451
    362452/**