diff --git a/wp-content/themes/classic/comments-popup.php b/wp-content/themes/classic/comments-popup.php index 4d22c93c7e..f42d38dced 100644 --- a/wp-content/themes/classic/comments-popup.php +++ b/wp-content/themes/classic/comments-popup.php @@ -32,8 +32,8 @@ foreach ($posts as $post) { start_wp(); $comment_author = (isset($_COOKIE['comment_author_' . COOKIEHASH])) ? trim($_COOKIE['comment_author_'. COOKIEHASH]) : ''; $comment_author_email = (isset($_COOKIE['comment_author_email_'. COOKIEHASH])) ? trim($_COOKIE['comment_author_email_'. COOKIEHASH]) : ''; $comment_author_url = (isset($_COOKIE['comment_author_url_'. COOKIEHASH])) ? trim($_COOKIE['comment_author_url_'. COOKIEHASH]) : ''; -$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date"); -$commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $wpdb->posts WHERE ID = $id"); +$comments = get_approved_comments($id); +$commentstatus = get_post($id); if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $commentstatus->post_password) { // and it doesn't match the cookie echo(get_the_password_form()); } else { ?> diff --git a/wp-content/themes/classic/footer.php b/wp-content/themes/classic/footer.php index 047982e9d3..0894f78eda 100644 --- a/wp-content/themes/classic/footer.php +++ b/wp-content/themes/classic/footer.php @@ -3,7 +3,7 @@ -

WordPress"), __("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?>

+

WordPress"), __("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?>

diff --git a/wp-content/themes/default/comments-popup.php b/wp-content/themes/default/comments-popup.php index 980717b905..d5dd176388 100644 --- a/wp-content/themes/default/comments-popup.php +++ b/wp-content/themes/default/comments-popup.php @@ -32,9 +32,9 @@ foreach ($posts as $post) { start_wp(); $comment_author = (isset($_COOKIE['comment_author_' . COOKIEHASH])) ? trim($_COOKIE['comment_author_'. COOKIEHASH]) : ''; $comment_author_email = (isset($_COOKIE['comment_author_email_'. COOKIEHASH])) ? trim($_COOKIE['comment_author_email_'. COOKIEHASH]) : ''; $comment_author_url = (isset($_COOKIE['comment_author_url_'. COOKIEHASH])) ? trim($_COOKIE['comment_author_url_'. COOKIEHASH]) : ''; -$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date"); -$commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $wpdb->posts WHERE ID = $id"); -if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $commentstatus->post_password) { // and it doesn't match the cookie +$comments = get_approved_comments($id); +$post = get_post($id); +if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie echo(get_the_password_form()); } else { ?> @@ -52,7 +52,7 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH

No comments yet.

-comment_status) { ?> +comment_status) { ?>

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed:

diff --git a/wp-content/themes/default/footer.php b/wp-content/themes/default/footer.php index 2973ab6028..a6cfd870ad 100644 --- a/wp-content/themes/default/footer.php +++ b/wp-content/themes/default/footer.php @@ -6,7 +6,7 @@ WordPress
Entries (RSS) and Comments (RSS). - +

diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index ee1a666fe8..243800abb8 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -863,4 +863,9 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $ return true; } +function get_approved_comments($post_id) { + global $wpdb; + return $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post_id AND comment_approved = '1' ORDER BY comment_date"); +} + ?> diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 281bd613e0..ff653eb9c0 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2146,4 +2146,9 @@ function plugin_basename($file) { return $file; } -?> +function get_num_queries() { + global $wpdb; + return $wpdb->num_queries; +} + +?> \ No newline at end of file