How do I browse WordPress Comment Feed by page?
-
There isn’t a “page 2” in a feed file. The paging of the file is determined by the feed reader.
I can still paginate on posts with ?paged=# parameter, I thought there’s also way to see comments that way.
My intention is to fetch all comments of a specific post via feed. Is it possible?
Thanks.
I’m also looking for an option to show all comments via RSS, anyone?
Ok, I’ve created some sort of solution…
I’ve used this code to create a custom RSS feed:
http://xplus3.net/2008/10/30/custom-feeds-in-wordpress/After that, I made a feed distinction for posts/comments
function myPlugin_create_feed() { //header('Content-type: text/xml'); if(is_single()) { include('my_comments_feed.php'); } else { include('my_feed.php'); } }
Fot my_comments_feed.php I copy-pasted the standard RSS2 Feed Template, but it still only showed the default number of items. So I changed the code, beginning at line 34:
<?php do_action('commentsrss2_head'); ?> <?php if(is_single()) { // activate custom query: global $post, $wp_query; $wp_query->comments = get_comments( array( 'post_id' => $post->ID, 'status' => 'approve', 'type' => 'comment' ) ); } $results = $wp_query->comments; foreach ($results as $result) { //echo $result->comment_author . "<br>\n"; $mycomment_author = apply_filters('comment_author_rss', $result->comment_author); $mycomment_time = mysql2date('Y-m-d H:i:s', $result->comment_date_gmt, false); $mycomment_text = apply_filters('comment_text', $result->comment_content); $mycomment_text_rss = apply_filters('comment_text_rss', $result->comment_content); $mycomment_link = esc_url( apply_filters('the_permalink_rss', get_permalink() )) . "#comment-" . $result->comment_ID; echo " <item>\n"; echo " <title>". $mycomment_author . "</title>\n"; echo " <link>" . $mycomment_link . "</link>\n"; echo " <dc:creator>" . $mycomment_author . "</dc:creator>\n"; echo " <pubDate>". mysql2date('D, d M Y H:i:s +0000', $mycomment_time, false) . "</pubDate>\n"; echo " <guid isPermaLink=\"false\">" . get_comment_guid($result->comment_ID) . "</guid>\n"; echo " <description>" . $mycomment_text_rss . "</description>\n"; echo " <content:encoded><![CDATA[" . $mycomment_text . "]]></content:encoded>\n"; echo " </item>\n"; } ?> </channel> </rss>
There might be a simpler solution, but this seems to work!
- The topic ‘How do I browse WordPress Comment Feed by page?’ is closed to new replies.
(@elado)
13 years, 11 months ago
Can I browse a blog’s comments feed further than the first page (usually 10 comments)
I know there’s a comments feed:
/comments/feed
and comments feed for a specific post:
/feed?p=23
and posts feed which can be paginated:
/feed?paged=2
and the ability to pageinate comments on a post using
comment-page-2
orcpage=2
on a post (not in feed).But how do I go to page #2 on a comments feed? Or on a specific post’s comments feed?
I tried all sorts of combinations, with no help:
/comments/feed/comment-page-2
,/comments/comment-page-2/feed
,/comments/feed?paged=2
,/comments/feed?cpage=2
,/feed?p=23&cpage=2
(that redirects to –>)/post-slug/feed/comment-page-2
(returns 404),/post-slug/feed?cpage=2
,/post-slug/comment-page-2/feed/
(returns 404)Is it even possible?
Thanks.