Cache category hierarchy to make cat listing faster. Phase 1. see #3985

git-svn-id: https://develop.svn.wordpress.org/trunk@5178 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-04-04 20:44:45 +00:00
parent 8a155e75f5
commit 93cdc6deac
3 changed files with 29 additions and 3 deletions
+4 -1
View File
@@ -791,12 +791,15 @@ function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
if (!$categories )
$categories = get_categories( 'hide_empty=0' );
$children = _get_category_hierarchy();
if ( $categories ) {
ob_start();
foreach ( $categories as $category ) {
if ( $category->category_parent == $parent) {
echo "\t" . _cat_row( $category, $level );
cat_rows( $category->cat_ID, $level +1, $categories );
if ( isset($children[$category->cat_ID]) )
cat_rows( $category->cat_ID, $level +1, $categories );
}
}
$output = ob_get_contents();