Ticket #13867: feed-rss2-comments.php.diff

File feed-rss2-comments.php.diff, 1.9 KB (added by shidouhikari, 3 years ago)

Adds 2 filtters to allow plugins to edit comments titles in RSS feed

  • wp-includes/feed-rss2-comments.php

     
    1818        > 
    1919<channel> 
    2020        <title><?php 
     21                $head_title = ''; 
    2122                if ( is_singular() ) 
    22                         printf(ent2ncr(__('Comments on: %s')), get_the_title_rss()); 
     23                        $head_title = sprintf(ent2ncr(__('Comments on: %s')), get_the_title_rss()); 
    2324                elseif ( is_search() ) 
    24                         printf(ent2ncr(__('Comments for %s searching on %s')), get_bloginfo_rss( 'name' ), esc_attr($wp_query->query_vars['s'])); 
     25                        $head_title = sprintf(ent2ncr(__('Comments for %s searching on %s')), get_bloginfo_rss( 'name' ), esc_attr($wp_query->query_vars['s'])); 
    2526                else 
    26                         printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); 
     27                        $head_title = sprintf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); 
     28                echo apply_filters('commentsrss2_head_title',$head_title); 
    2729        ?></title> 
    2830        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> 
    2931        <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link> 
     
    3941?> 
    4042        <item> 
    4143                <title><?php 
     44                        $item_title = ''; 
    4245                        if ( !is_singular() ) { 
    4346                                $title = get_the_title($comment_post->ID); 
    4447                                $title = apply_filters('the_title_rss', $title); 
    45                                 printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss()); 
     48                                $item_title = sprintf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss()); 
    4649                        } else { 
    47                                 printf(ent2ncr(__('By: %s')), get_comment_author_rss()); 
     50                                $item_title = sprintf(ent2ncr(__('By: %s')), get_comment_author_rss()); 
    4851                        } 
     52                        echo apply_filters('commentrss2_item_title', $item_title, $comment); 
    4953                ?></title> 
    5054                <link><?php comment_link() ?></link> 
    5155                <dc:creator><?php echo get_comment_author_rss() ?></dc:creator>