Support » Plugins » Add Post Title to Comments Feed

  • I’m wanting my comments feed to have more information besides: ‘By: Commenter’. I’d like for it to read:

    Commenter on ‘Post Title’

    I’ve been tinkering with the arrays and variables but I’m not even sure if the comments array has the post title in it.

    Any ideas? Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Try this for getting the post title:

    <?php echo $post->post_title; ?>

    Nope – that’s not it – it’s giving me the title of most recently published post for the title of all the comment feed items. I think this is because I’m out of the wp loop right?

    Alrighty, then try this one:

    <?php echo get_the_title($comment->comment_post_ID); ?>

    It’s weird, ‘$comment->comment_post_ID’ outputs the correct post ID# per commetn but ‘<?php echo get_the_title($comment->comment_post_ID); ?>’ still pops in the title of the most recent published post.

    Has anyone solved this one?

    There seems to be a bug report on this, but I can’t tell whether it has been fixed or not:

    Anyone know the status of this?

    OK. I think I figured it out. The bug report includes a “patch” which is basically a way to hack the code. Here is what I did, use with discression since I don’t know what I’m doing:

    Open the file wp-commentsrss2.php in your root WP directory.

    Find line #52, with this code:

    <title>by: <?php comment_author_rss() ?></title>

    Replace that with this:

    <title><?php if ( (! is_single()) || (! is_page()) ) {
    $title = get_the_title($comment->comment_post_ID);
    $title = apply_filters('the_title', $title);
    $title = apply_filters('the_title_rss', $title);
    echo "Comment on $title";
    } ?> by: <?php comment_author_rss() ?></title>

    Hopefully that will do the trick!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add Post Title to Comments Feed’ is closed to new replies.