3 * RSS2 Feed Template for displaying RSS2 Comments feed.
8 header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
10 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
12 /** This action is documented in wp-includes/feed-rss2.php */
13 do_action( 'rss_tag_pre', 'rss2-comments' );
16 xmlns:content="http://purl.org/rss/1.0/modules/content/"
17 xmlns:dc="http://purl.org/dc/elements/1.1/"
18 xmlns:atom="http://www.w3.org/2005/Atom"
19 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
21 /** This action is documented in wp-includes/feed-rss2.php */
22 do_action( 'rss2_ns' );
27 * Fires at the end of the RSS root to add namespaces.
31 do_action( 'rss2_comments_ns' );
36 if ( is_singular() ) {
37 /* translators: Comments feed title. 1: Post title */
38 printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
39 } elseif ( is_search() ) {
40 /* translators: Comments feed title. 1: Site name, 2: Search query */
41 printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
43 /* translators: Comments feed title. 1: Site name */
44 printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() );
47 <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
48 <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
49 <description><?php bloginfo_rss("description") ?></description>
51 $date = get_lastcommentmodified( 'GMT' );
52 echo $date ? mysql2date( 'r', $date ) : date( 'r' );
54 <sy:updatePeriod><?php
55 /** This filter is documented in wp-includes/feed-rss2.php */
56 echo apply_filters( 'rss_update_period', 'hourly' );
58 <sy:updateFrequency><?php
59 /** This filter is documented in wp-includes/feed-rss2.php */
60 echo apply_filters( 'rss_update_frequency', '1' );
61 ?></sy:updateFrequency>
64 * Fires at the end of the RSS2 comment feed header.
68 do_action( 'commentsrss2_head' );
70 if ( have_comments() ) : while ( have_comments() ) : the_comment();
71 $comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID );
75 if ( !is_singular() ) {
76 $title = get_the_title($comment_post->ID);
77 /** This filter is documented in wp-includes/feed.php */
78 $title = apply_filters( 'the_title_rss', $title );
79 /* translators: Individual comment title. 1: Post title, 2: Comment author name */
80 printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
82 /* translators: Comment author title. 1: Comment author name */
83 printf(ent2ncr(__('By: %s')), get_comment_author_rss());
86 <link><?php comment_link() ?></link>
87 <dc:creator><![CDATA[<?php echo get_comment_author_rss() ?>]]></dc:creator>
88 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true, false), false); ?></pubDate>
89 <guid isPermaLink="false"><?php comment_guid() ?></guid>
90 <?php if ( post_password_required($comment_post) ) : ?>
91 <description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>
92 <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
93 <?php else : // post pass ?>
94 <description><![CDATA[<?php comment_text_rss() ?>]]></description>
95 <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
96 <?php endif; // post pass
98 * Fires at the end of each RSS2 comment feed item.
102 * @param int $comment->comment_ID The ID of the comment being displayed.
103 * @param int $comment_post->ID The ID of the post the comment is connected to.
105 do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
108 <?php endwhile; endif; ?>