Indentation and correct response link when no comments, fixes #1408
git-svn-id: http://svn.automattic.com/wordpress/trunk@2685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
76fd741767
commit
f048ab7b0a
|
@ -89,45 +89,47 @@ function comments_popup_script($width=400, $height=400, $file='') {
|
||||||
}
|
}
|
||||||
|
|
||||||
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
|
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
|
||||||
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb;
|
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb;
|
||||||
global $comment_count_cache;
|
global $comment_count_cache;
|
||||||
|
|
||||||
if (! is_single() && ! is_page()) {
|
if (! is_single() && ! is_page()) {
|
||||||
if ( !isset($comment_count_cache[$id]))
|
if ( !isset($comment_count_cache[$id]) )
|
||||||
$comment_count_cache[$id] = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");
|
$comment_count_cache[$id] = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");
|
||||||
|
|
||||||
$number = $comment_count_cache[$id];
|
$number = $comment_count_cache[$id];
|
||||||
|
|
||||||
if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) {
|
if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) {
|
||||||
echo $none;
|
echo $none;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (!empty($post->post_password)) { // if there's a password
|
if (!empty($post->post_password)) { // if there's a password
|
||||||
if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
|
if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
|
||||||
echo('Enter your password to view comments');
|
echo('Enter your password to view comments');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '<a href="';
|
echo '<a href="';
|
||||||
if ($wpcommentsjavascript) {
|
if ($wpcommentsjavascript) {
|
||||||
if ( empty($wpcommentspopupfile) )
|
if ( empty($wpcommentspopupfile) )
|
||||||
$home = get_settings('home');
|
$home = get_settings('home');
|
||||||
else
|
else
|
||||||
$home = get_settings('siteurl');
|
$home = get_settings('siteurl');
|
||||||
echo $home . '/' . $wpcommentspopupfile.'?comments_popup='.$id;
|
echo $home . '/' . $wpcommentspopupfile.'?comments_popup='.$id;
|
||||||
echo '" onclick="wpopen(this.href); return false"';
|
echo '" onclick="wpopen(this.href); return false"';
|
||||||
} else {
|
} else { // if comments_popup_script() is not in the template, display simple comment link
|
||||||
// if comments_popup_script() is not in the template, display simple comment link
|
if ( 0 == $number )
|
||||||
comments_link();
|
echo get_permalink() . '#respond';
|
||||||
echo '"';
|
else
|
||||||
}
|
comments_link();
|
||||||
if (!empty($CSSclass)) {
|
echo '"';
|
||||||
echo ' class="'.$CSSclass.'"';
|
}
|
||||||
}
|
if (!empty($CSSclass)) {
|
||||||
echo '>';
|
echo ' class="'.$CSSclass.'"';
|
||||||
comments_number($zero, $one, $more, $number);
|
}
|
||||||
echo '</a>';
|
echo '>';
|
||||||
}
|
comments_number($zero, $one, $more, $number);
|
||||||
|
echo '</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue