Make WordPress Core


Ignore:
Timestamp:
02/24/2007 07:33:29 AM (18 years ago)
Author:
ryan
Message:

Comment feeds everywhere. Props mdawaffe and rob1n. fixes #2485

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/feed-atom-comments.php

    r4928 r4934  
    99>
    1010    <title type="text"><?php
    11         if (is_single() || is_page()) {
     11        if ( is_singular() )
    1212            printf(__('Comments on: %s'), get_the_title_rss());
    13         } else {
    14             printf(__('Comments for %s'), get_bloginfo_rss('name'));
    15         }
     13        elseif ( is_search() )
     14            printf(__('Comments for %s searching on %s'), get_bloginfo_rss( 'name' ), attribute_escape($wp_query->query_vars['s']));
     15        else
     16            printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
    1617    ?></title>
    1718    <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
     
    2526
    2627<?php
    27 $i = 0;
    28 if (have_posts()) :
    29     while (have_posts()) : the_post();
    30         if ($i < 1) {
    31             $i++;
    32         }
    33        
    34         if (is_single() || is_page()) {
    35             $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
    36             comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
    37             $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
    38             LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "'
    39             AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish'
    40             AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "'
    41             ORDER BY comment_date_gmt ASC" );
    42         } else { // if no post id passed in, we'll just use the last posts_per_rss comments.
    43             $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
    44             comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
    45             $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
    46             LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish'
    47             AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "' 
    48             ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') );
    49         }
    50        
    51         if ($comments) {
    52             foreach ($comments as $comment) {
    53                 $GLOBALS['comment'] =& $comment;
    54                 get_post_custom($comment->comment_post_ID);
     28if ( have_comments() ) : while ( have_comments() ) : the_comment();
     29    $comment_post = get_post($comment->comment_post_ID);
     30    get_post_custom($comment_post->ID);
    5531?>
    5632    <entry>
    5733        <title><?php
    58             if (!(is_single() || is_page())) {
    59                 $title = get_the_title($comment->comment_post_ID);
     34            if ( !is_singular() ) {
     35                $title = get_the_title($comment_post->ID);
    6036                $title = apply_filters('the_title', $title);
    6137                $title = apply_filters('the_title_rss', $title);
     
    7046            <name><?php comment_author_rss(); ?></name>
    7147            <?php if (get_comment_author_url()) echo '<uri>' . get_comment_author_url() . '</uri>'; ?>
     48
    7249        </author>
    7350       
     
    7552        <updated><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></updated>
    7653        <published><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></published>
    77        
    78     <?php if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) { ?>
     54<?php if (!empty($comment_post->post_password) && $_COOKIE['wp-postpass'] != $comment_post->post_password) : ?>
    7955        <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>
    80     <?php } else { ?>
     56<?php else : // post pass ?>
    8157        <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
    82     <?php } ?>
     58<?php endif; // post pass
     59    do_action('comment_atom_entry', $comment->comment_ID, $comment_post->ID);
     60?>
    8361    </entry>
    84 <?php
    85             }
    86         }
    87        
    88     endwhile;
    89 endif;
    90 ?>
     62<?php endwhile; endif; ?>
    9163</feed>
Note: See TracChangeset for help on using the changeset viewer.