[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> feed-rss2-comments.php (source)

   1  <?php
   2  /**
   3   * RSS2 Feed Template for displaying RSS2 Comments feed.
   4   *
   5   * @package WordPress
   6   */
   7  
   8  header( 'Content-Type: ' . feed_content_type( 'rss2' ) . '; charset=' . get_option( 'blog_charset' ), true );
   9  
  10  echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
  11  
  12  /** This action is documented in wp-includes/feed-rss2.php */
  13  do_action( 'rss_tag_pre', 'rss2-comments' );
  14  ?>
  15  <rss version="2.0"
  16      <?php
  17      wp_feed_namespaces( 'rss2-comments' );
  18  
  19      /** This action is documented in wp-includes/feed-rss2.php */
  20      do_action( 'rss2_ns' );
  21      ?>
  22  
  23      <?php
  24      /**
  25       * Fires at the end of the RSS root to add namespaces.
  26       *
  27       * Consider using the {@see 'wp_feed_namespaces'} filter instead, which
  28       * prevents duplicate `xmlns` attributes.
  29       *
  30       * @since 2.8.0
  31       */
  32      do_action( 'rss2_comments_ns' );
  33      ?>
  34  >
  35  <channel>
  36      <title>
  37      <?php
  38      if ( is_singular() ) {
  39          /* translators: Comments feed title. %s: Post title. */
  40          printf( ent2ncr( __( 'Comments on: %s' ) ), get_the_title_rss() );
  41      } elseif ( is_search() ) {
  42          /* translators: Comments feed title. 1: Site title, 2: Search query. */
  43          printf( ent2ncr( __( 'Comments for %1$s searching on %2$s' ) ), get_bloginfo_rss( 'name' ), get_search_query() );
  44      } else {
  45          /* translators: Comments feed title. %s: Site title. */
  46          printf( ent2ncr( __( 'Comments for %s' ) ), get_wp_title_rss() );
  47      }
  48      ?>
  49      </title>
  50      <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
  51      <link><?php ( is_single() ) ? the_permalink_rss() : bloginfo_rss( 'url' ); ?></link>
  52      <description><?php bloginfo_rss( 'description' ); ?></description>
  53      <lastBuildDate><?php echo get_feed_build_date( 'r' ); ?></lastBuildDate>
  54      <sy:updatePeriod>
  55      <?php
  56          /** This filter is documented in wp-includes/feed-rss2.php */
  57          echo apply_filters( 'rss_update_period', 'hourly' );
  58      ?>
  59      </sy:updatePeriod>
  60      <sy:updateFrequency>
  61      <?php
  62          /** This filter is documented in wp-includes/feed-rss2.php */
  63          echo apply_filters( 'rss_update_frequency', '1' );
  64      ?>
  65      </sy:updateFrequency>
  66      <?php
  67      /**
  68       * Fires at the end of the RSS2 comment feed header.
  69       *
  70       * @since 2.3.0
  71       */
  72      do_action( 'commentsrss2_head' );
  73  
  74      while ( have_comments() ) :
  75          the_comment();
  76          $comment_post = get_post( $comment->comment_post_ID );
  77          /**
  78           * @global WP_Post $post Global post object.
  79           */
  80          $GLOBALS['post'] = $comment_post;
  81          ?>
  82      <item>
  83          <title>
  84          <?php
  85          if ( ! is_singular() ) {
  86              $title = get_the_title( $comment_post->ID );
  87              /** This filter is documented in wp-includes/feed.php */
  88              $title = apply_filters( 'the_title_rss', $title );
  89              /* translators: Individual comment title. 1: Post title, 2: Comment author name. */
  90              printf( ent2ncr( __( 'Comment on %1$s by %2$s' ) ), $title, get_comment_author_rss() );
  91          } else {
  92              /* translators: Comment author title. %s: Comment author name. */
  93              printf( ent2ncr( __( 'By: %s' ) ), get_comment_author_rss() );
  94          }
  95          ?>
  96          </title>
  97          <link><?php comment_link(); ?></link>
  98  
  99          <dc:creator><![CDATA[<?php echo get_comment_author_rss(); ?>]]></dc:creator>
 100          <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>
 101          <guid isPermaLink="false"><?php comment_guid(); ?></guid>
 102  
 103          <?php if ( post_password_required( $comment_post ) ) : ?>
 104              <description><?php echo ent2ncr( __( 'Protected Comments: Please enter your password to view comments.' ) ); ?></description>
 105              <content:encoded><![CDATA[<?php echo get_the_password_form(); ?>]]></content:encoded>
 106          <?php else : ?>
 107              <description><![CDATA[<?php comment_text_rss(); ?>]]></description>
 108              <content:encoded><![CDATA[<?php comment_text(); ?>]]></content:encoded>
 109          <?php endif; // End if post_password_required(). ?>
 110  
 111          <?php
 112          /**
 113           * Fires at the end of each RSS2 comment feed item.
 114           *
 115           * @since 2.1.0
 116           *
 117           * @param int $comment_id      The ID of the comment being displayed.
 118           * @param int $comment_post_id The ID of the post the comment is connected to.
 119           */
 120          do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
 121          ?>
 122      </item>
 123      <?php endwhile; ?>
 124  </channel>
 125  </rss>


Generated : Tue Sep 8 08:20:28 2026 Cross-referenced by PHPXref