]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/feed-rss2.php
WordPress 4.7
[autoinstalls/wordpress.git] / wp-includes / feed-rss2.php
index 2390c2d957a04a8aa0c8804eaa3031fb7c416259..a7b9ac7ec1c9144a2093f136ad755f97fdfdfa74 100644 (file)
@@ -5,7 +5,7 @@
  * @package WordPress
  */
 
-header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
+header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
 $more = 1;
 
 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
@@ -38,17 +38,20 @@ do_action( 'rss_tag_pre', 'rss2' );
 >
 
 <channel>
-       <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
+       <title><?php wp_title_rss(); ?></title>
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php bloginfo_rss('url') ?></link>
        <description><?php bloginfo_rss("description") ?></description>
-       <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
+       <lastBuildDate><?php
+               $date = get_lastpostmodified( 'GMT' );
+               echo $date ? mysql2date( 'D, d M Y H:i:s +0000', $date ) : date( 'D, d M Y H:i:s +0000' );
+       ?></lastBuildDate>
        <language><?php bloginfo_rss( 'language' ); ?></language>
        <sy:updatePeriod><?php
                $duration = 'hourly';
 
                /**
-                * Filter how often to update the RSS feed.
+                * Filters how often to update the RSS feed.
                 *
                 * @since 2.1.0
                 *
@@ -61,7 +64,7 @@ do_action( 'rss_tag_pre', 'rss2' );
                $frequency = '1';
 
                /**
-                * Filter the RSS update frequency.
+                * Filters the RSS update frequency.
                 *
                 * @since 2.1.0
                 *
@@ -83,7 +86,9 @@ do_action( 'rss_tag_pre', 'rss2' );
        <item>
                <title><?php the_title_rss() ?></title>
                <link><?php the_permalink_rss() ?></link>
+<?php if ( get_comments_number() || comments_open() ) : ?>
                <comments><?php comments_link_feed(); ?></comments>
+<?php endif; ?>
                <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
                <dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator>
                <?php the_category_rss('rss2') ?>
@@ -100,8 +105,10 @@ do_action( 'rss_tag_pre', 'rss2' );
                <content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
        <?php endif; ?>
 <?php endif; ?>
+<?php if ( get_comments_number() || comments_open() ) : ?>
                <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
                <slash:comments><?php echo get_comments_number(); ?></slash:comments>
+<?php endif; ?>
 <?php rss_enclosure(); ?>
        <?php
        /**