mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
Reducing queries and forward thinking database fields.
git-svn-id: https://develop.svn.wordpress.org/trunk@1185 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -30,8 +30,9 @@ function clean_url($url) {
|
||||
}
|
||||
|
||||
function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $number='') {
|
||||
global $id, $comment, $tablecomments, $wpdb;
|
||||
if ('' == $number) $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'");
|
||||
global $id, $comment, $tablecomments, $wpdb, $comment_count_cache;
|
||||
if ('' == $comment_count_cache["$id"]) $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'");
|
||||
else $number = $comment_count_cache["$id"];
|
||||
if ($number == 0) {
|
||||
$blah = $zero;
|
||||
} elseif ($number == 1) {
|
||||
|
||||
Reference in New Issue
Block a user