Category count fix from MichaelH. fixes #2212

git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@3556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-02-19 11:24:21 +00:00
parent b4166d8f13
commit 10c4b7f229

View File

@ -588,7 +588,6 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
foreach ($categories as $category) { foreach ($categories as $category) {
if ($category->category_parent == $parent) { if ($category->category_parent == $parent) {
$category->cat_name = wp_specialchars($category->cat_name); $category->cat_name = wp_specialchars($category->cat_name);
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
$pad = str_repeat('— ', $level); $pad = str_repeat('— ', $level);
if ( current_user_can('manage_categories') ) { if ( current_user_can('manage_categories') ) {
$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>"; $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
@ -605,7 +604,7 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
$class = ('alternate' == $class) ? '' : 'alternate'; $class = ('alternate' == $class) ? '' : 'alternate';
echo "<tr id='cat-$category->cat_ID' class='$class'><th scope='row'>$category->cat_ID</th><td>$pad $category->cat_name</td> echo "<tr id='cat-$category->cat_ID' class='$class'><th scope='row'>$category->cat_ID</th><td>$pad $category->cat_name</td>
<td>$category->category_description</td> <td>$category->category_description</td>
<td>$count</td> <td>$category->category_count</td>
<td>$edit</td> <td>$edit</td>
</tr>"; </tr>";
cat_rows($category->cat_ID, $level +1, $categories); cat_rows($category->cat_ID, $level +1, $categories);