Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 

125 řádky
3.7 KiB

  1. <?php
  2. /**
  3. * RSS2 Feed Template for displaying RSS2 Posts feed.
  4. *
  5. * @package WordPress
  6. */
  7. header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
  8. $more = 1;
  9. echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
  10. /**
  11. * Fires between the xml and rss tags in a feed.
  12. *
  13. * @since 4.0.0
  14. *
  15. * @param string $context Type of feed. Possible values include 'rss2', 'rss2-comments',
  16. * 'rdf', 'atom', and 'atom-comments'.
  17. */
  18. do_action( 'rss_tag_pre', 'rss2' );
  19. ?>
  20. <rss version="2.0"
  21. xmlns:content="http://purl.org/rss/1.0/modules/content/"
  22. xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  23. xmlns:dc="http://purl.org/dc/elements/1.1/"
  24. xmlns:atom="http://www.w3.org/2005/Atom"
  25. xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  26. xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  27. <?php
  28. /**
  29. * Fires at the end of the RSS root to add namespaces.
  30. *
  31. * @since 2.0.0
  32. */
  33. do_action( 'rss2_ns' );
  34. ?>
  35. >
  36. <channel>
  37. <title><?php wp_title_rss(); ?></title>
  38. <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
  39. <link><?php bloginfo_rss('url') ?></link>
  40. <description><?php bloginfo_rss("description") ?></description>
  41. <lastBuildDate><?php
  42. $date = get_lastpostmodified( 'GMT' );
  43. echo $date ? mysql2date( 'D, d M Y H:i:s +0000', $date, false ) : date( 'D, d M Y H:i:s +0000' );
  44. ?></lastBuildDate>
  45. <language><?php bloginfo_rss( 'language' ); ?></language>
  46. <sy:updatePeriod><?php
  47. $duration = 'hourly';
  48. /**
  49. * Filters how often to update the RSS feed.
  50. *
  51. * @since 2.1.0
  52. *
  53. * @param string $duration The update period. Accepts 'hourly', 'daily', 'weekly', 'monthly',
  54. * 'yearly'. Default 'hourly'.
  55. */
  56. echo apply_filters( 'rss_update_period', $duration );
  57. ?></sy:updatePeriod>
  58. <sy:updateFrequency><?php
  59. $frequency = '1';
  60. /**
  61. * Filters the RSS update frequency.
  62. *
  63. * @since 2.1.0
  64. *
  65. * @param string $frequency An integer passed as a string representing the frequency
  66. * of RSS updates within the update period. Default '1'.
  67. */
  68. echo apply_filters( 'rss_update_frequency', $frequency );
  69. ?></sy:updateFrequency>
  70. <?php
  71. /**
  72. * Fires at the end of the RSS2 Feed Header.
  73. *
  74. * @since 2.0.0
  75. */
  76. do_action( 'rss2_head');
  77. while( have_posts()) : the_post();
  78. ?>
  79. <item>
  80. <title><?php the_title_rss() ?></title>
  81. <link><?php the_permalink_rss() ?></link>
  82. <?php if ( get_comments_number() || comments_open() ) : ?>
  83. <comments><?php comments_link_feed(); ?></comments>
  84. <?php endif; ?>
  85. <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
  86. <dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator>
  87. <?php the_category_rss('rss2') ?>
  88. <guid isPermaLink="false"><?php the_guid(); ?></guid>
  89. <?php if (get_option('rss_use_excerpt')) : ?>
  90. <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
  91. <?php else : ?>
  92. <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
  93. <?php $content = get_the_content_feed('rss2'); ?>
  94. <?php if ( strlen( $content ) > 0 ) : ?>
  95. <content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
  96. <?php else : ?>
  97. <content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
  98. <?php endif; ?>
  99. <?php endif; ?>
  100. <?php if ( get_comments_number() || comments_open() ) : ?>
  101. <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
  102. <slash:comments><?php echo get_comments_number(); ?></slash:comments>
  103. <?php endif; ?>
  104. <?php rss_enclosure(); ?>
  105. <?php
  106. /**
  107. * Fires at the end of each RSS2 feed item.
  108. *
  109. * @since 2.0.0
  110. */
  111. do_action( 'rss2_item' );
  112. ?>
  113. </item>
  114. <?php endwhile; ?>
  115. </channel>
  116. </rss>