diff --git a/wp-includes/template-functions.php b/wp-includes/template-functions.php
index 14906e63dc..ab862a0171 100644
--- a/wp-includes/template-functions.php
+++ b/wp-includes/template-functions.php
@@ -458,7 +458,7 @@ function get_calendar($daylength = 1) {
}
$pad = 7 - date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear));
- if (0 != $pad)
+ if ($pad != 0 && $pad != 7)
echo "\n\t\t
| ";
echo "\n\t\n\t\n\t";
@@ -1591,7 +1591,7 @@ function comments_popup_script($width=400, $height=400, $file='wp-comments-popup
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash;
global $querystring_start, $querystring_equal, $querystring_separator, $siteurl;
- $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1';");
+ $number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1';");
if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) {
echo $none;
return;