Comment feed fixes from David House. fixes #2570
git-svn-id: http://svn.automattic.com/wordpress/trunk@3644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4b7d1d077d
commit
667597592c
|
@ -31,7 +31,7 @@ if (have_posts()) :
|
||||||
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
|
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
|
||||||
comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
|
comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID,
|
||||||
$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
|
$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
|
||||||
LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '$id'
|
LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "'
|
||||||
AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish'
|
AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish'
|
||||||
AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "'
|
AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "'
|
||||||
ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') );
|
ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') );
|
||||||
|
@ -46,6 +46,7 @@ if (have_posts()) :
|
||||||
// this line is WordPress' motor, do not delete it.
|
// this line is WordPress' motor, do not delete it.
|
||||||
if ($comments) {
|
if ($comments) {
|
||||||
foreach ($comments as $comment) {
|
foreach ($comments as $comment) {
|
||||||
|
$GLOBALS['comment'] =& $comment;
|
||||||
// Some plugins may need to know the metadata
|
// Some plugins may need to know the metadata
|
||||||
// associated with this comment's post:
|
// associated with this comment's post:
|
||||||
get_post_custom($comment->comment_post_ID);
|
get_post_custom($comment->comment_post_ID);
|
||||||
|
|
|
@ -2015,7 +2015,7 @@ function remove_query_arg($key, $query) {
|
||||||
|
|
||||||
function load_template($file) {
|
function load_template($file) {
|
||||||
global $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query,
|
global $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query,
|
||||||
$wp_rewrite, $wpdb, $wp_version, $wp;
|
$wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment;
|
||||||
|
|
||||||
extract($wp_query->query_vars);
|
extract($wp_query->query_vars);
|
||||||
|
|
||||||
|
@ -2220,7 +2220,7 @@ function do_feed() {
|
||||||
$feed = 'rss2';
|
$feed = 'rss2';
|
||||||
|
|
||||||
$for_comments = false;
|
$for_comments = false;
|
||||||
if ( is_single() || ($withcomments == 1) ) {
|
if ( is_single() || (get_query_var('withcomments') == 1) ) {
|
||||||
$feed = 'rss2';
|
$feed = 'rss2';
|
||||||
$for_comments = true;
|
$for_comments = true;
|
||||||
}
|
}
|
||||||
|
@ -2238,10 +2238,11 @@ function do_feed_rss() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_feed_rss2($for_comments) {
|
function do_feed_rss2($for_comments) {
|
||||||
if ( $for_comments )
|
if ( $for_comments ) {
|
||||||
load_template(ABSPATH . 'wp-commentsrss2.php');
|
load_template(ABSPATH . 'wp-commentsrss2.php');
|
||||||
else
|
} else {
|
||||||
load_template(ABSPATH . 'wp-rss2.php');
|
load_template(ABSPATH . 'wp-rss2.php');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_feed_atom() {
|
function do_feed_atom() {
|
||||||
|
|
|
@ -15,6 +15,10 @@ function the_ID() {
|
||||||
echo $id;
|
echo $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_the_ID() {
|
||||||
|
global $id;
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
function the_title($before = '', $after = '', $echo = true) {
|
function the_title($before = '', $after = '', $echo = true) {
|
||||||
$title = get_the_title();
|
$title = get_the_title();
|
||||||
|
|
Loading…
Reference in New Issue