WordPress.org

Make WordPress Core

Ticket #4477: get-the-title.diff

File get-the-title.diff, 4.1 KB (added by jhodgdon, 7 years ago)

Alternative patch that puts the filtering into get_the_title. Also removes filtering from the users of get_the_title, since they won't need fitlering now.

  • E:/EclipseWork/WordPressDev/wp-includes/post-template.php

     
    1717 
    1818 
    1919function the_title($before = '', $after = '', $echo = true) { 
    20         $title = get_the_title(); 
     20        $title = get_the_title( 0, false ); 
    2121        if ( strlen($title) > 0 ) { 
    2222                $title = apply_filters('the_title', $before . $title . $after, $before, $after); 
    2323                if ( $echo ) 
     
    2828} 
    2929 
    3030 
    31 function get_the_title($id = 0) { 
     31function get_the_title($id = 0, $filter = true ) { 
    3232        $post = &get_post($id); 
    3333 
    3434        $title = $post->post_title; 
     
    3737        else if ( 'private' == $post->post_status ) 
    3838                $title = sprintf(__('Private: %s'), $title); 
    3939 
     40        if( $filter )  
     41                $title = apply_filters( 'the_title', $title ); 
     42                 
    4043        return $title; 
    4144} 
    4245 
  • E:/EclipseWork/WordPressDev/wp-includes/feed-rss2-comments.php

     
    2929                <title><?php 
    3030                        if ( !is_singular() ) { 
    3131                                $title = get_the_title($comment_post->ID); 
    32                                 $title = apply_filters('the_title', $title); 
    3332                                $title = apply_filters('the_title_rss', $title); 
    3433                                printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss()); 
    3534                        } else { 
  • E:/EclipseWork/WordPressDev/wp-includes/feed.php

     
    2222 
    2323function get_the_title_rss() { 
    2424        $title = get_the_title(); 
    25         $title = apply_filters('the_title', $title); 
    2625        $title = apply_filters('the_title_rss', $title); 
    2726        return $title; 
    2827} 
  • E:/EclipseWork/WordPressDev/wp-includes/comment-template.php

     
    364364        if (!empty($CSSclass)) { 
    365365                echo ' class="'.$CSSclass.'"'; 
    366366        } 
    367         $title = attribute_escape(apply_filters('the_title', get_the_title())); 
     367        $title = attribute_escape(get_the_title()); 
    368368        echo ' title="' . sprintf( __('Comment on %s'), $title ) .'">'; 
    369369        comments_number($zero, $one, $more, $number); 
    370370        echo '</a>'; 
  • E:/EclipseWork/WordPressDev/wp-includes/feed-atom-comments.php

     
    3333                <title><?php 
    3434                        if ( !is_singular() ) { 
    3535                                $title = get_the_title($comment_post->ID); 
    36                                 $title = apply_filters('the_title', $title); 
    3736                                $title = apply_filters('the_title_rss', $title); 
    3837                                printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss()); 
    3938                        } else { 
  • E:/EclipseWork/WordPressDev/wp-admin/index.php

     
    4949<?php 
    5050if ( $comments ) { 
    5151foreach ($comments as $comment) { 
    52         echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . apply_filters('the_title', get_the_title($comment->comment_post_ID)) . '</a>'); 
     52        echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>'); 
    5353        edit_comment_link(__("Edit"), ' <small>(', ')</small>'); 
    5454        echo '</li>'; 
    5555}