Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 

111 рядки
4.0 KiB

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