From fc6e8c8741b93af07a7ce66731fa5a241ec4f1dc Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 23 Feb 2010 18:45:59 +0000 Subject: [PATCH] More output consolidation. see #11817 git-svn-id: http://svn.automattic.com/wordpress/trunk@13334 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/custom-navigation.php | 166 +++--------------------------- 1 file changed, 14 insertions(+), 152 deletions(-) diff --git a/wp-includes/custom-navigation.php b/wp-includes/custom-navigation.php index 486a9319a0..20928a08ef 100644 --- a/wp-includes/custom-navigation.php +++ b/wp-includes/custom-navigation.php @@ -70,6 +70,7 @@ function setup_menu_item($menu_item, $type = 'item', $position = 0) { } elseif ( 'category' == $type ) { $menu_item->type = $type; $menu_item->object_id = $menu_item->term_id; + $menu_item->ID = $menu_item->term_id; $menu_item->parent_item = $menu_item->parent; $menu_item->menu_order = $position; } elseif ( 'page' == $type ) { @@ -101,19 +102,19 @@ function setup_menu_item($menu_item, $type = 'item', $position = 0) { break; // Category Menu Item case 'category': - if ( $menu_item->guid == '' ) + if ( empty($menu_item->guid) ) $menu_item->link = get_category_link( $menu_item->object_id ); else $menu_item->link = $menu_item->guid; - if ( $menu_item->post_title == '' ) { - $title_raw = get_categories( array('include' => $menu_item->object_id) ); - $menu_item->title = htmlentities($title_raw[0]->cat_name); + if ( empty($menu_item->post_title) ) { + $title_raw = get_category( $menu_item->object_id ); + $menu_item->title = htmlentities($title_raw->cat_name); } else { $menu_item->title = htmlentities( $menu_item->post_title ); } - if ( $menu_item->post_content == '' ) + if ( empty($menu_item->post_content) ) $menu_item->description = htmlentities( strip_tags( category_description( $menu_item->object_id ) ) ); else $menu_item->description = htmlentities( $menu_item->post_content ); @@ -324,7 +325,6 @@ function wp_custom_nav_get_pages($counter, $type) { if ($post->post_parent == 0) { // Custom Menu if ( $type == 'menu' ) { - $description = get_post_meta($post->ID, 'page-description', true); $post = setup_menu_item($post, 'page', $intCounter); ?> @@ -414,46 +414,13 @@ function wp_custom_nav_get_categories($counter, $type) { // Display Loop foreach ( $categories_array as $cat_item ) { if ( $cat_item->parent == 0 ) { + $cat_item = setup_menu_item($cat_item, 'category', $intCounter); // Custom Menu if ( $type == 'menu' ) { ?>