diff --git wp-includes/nav-menu-template.php wp-includes/nav-menu-template.php
index 0ac14c3..b8fe3b4 100644
|
|
function wp_nav_menu( $args = array() ) { |
208 | 208 | // Set up the $menu_item variables |
209 | 209 | _wp_menu_item_classes_by_context( $menu_items ); |
210 | 210 | |
211 | | $sorted_menu_items = array(); |
212 | | foreach ( (array) $menu_items as $key => $menu_item ) |
213 | | $sorted_menu_items[$menu_item->menu_order] = $menu_item; |
| 211 | $sorted_menu_items = $menu_item_parents = array(); |
| 212 | foreach ( (array) $menu_items as $menu_item ) { |
| 213 | $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; |
| 214 | if ( $menu_item->menu_item_parent ) |
| 215 | $menu_item_parents[ $menu_item->menu_item_parent ] = true; |
| 216 | } |
| 217 | |
| 218 | //Add in the menu-item-parent class |
| 219 | if ( $menu_item_parents ) { |
| 220 | foreach ( $sorted_menu_items as &$menu_item ) { |
| 221 | if ( isset( $menu_item_parents[ $menu_item->ID ] ) ) |
| 222 | $menu_item->classes[] = 'menu-item-parent'; |
| 223 | } |
| 224 | } |
214 | 225 | |
215 | | unset($menu_items); |
| 226 | unset( $menu_items, $menu_item ); |
216 | 227 | |
217 | 228 | $sorted_menu_items = apply_filters( 'wp_nav_menu_objects', $sorted_menu_items, $args ); |
218 | 229 | |
diff --git wp-includes/post-template.php wp-includes/post-template.php
index facb36e..a657b5c 100644
|
|
function walk_page_tree($pages, $depth, $current_page, $r) { |
954 | 954 | else |
955 | 955 | $walker = $r['walker']; |
956 | 956 | |
| 957 | foreach ( (array) $pages as $page ) { |
| 958 | if ( $page->post_parent ) |
| 959 | $r['parent_pages'][ $page->post_parent ] = true; |
| 960 | } |
| 961 | |
957 | 962 | $args = array($pages, $depth, $r, $current_page); |
958 | 963 | return call_user_func_array(array($walker, 'walk'), $args); |
959 | 964 | } |
… |
… |
class Walker_Page extends Walker { |
1035 | 1040 | * @param array $args |
1036 | 1041 | */ |
1037 | 1042 | function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) { |
| 1043 | |
1038 | 1044 | if ( $depth ) |
1039 | 1045 | $indent = str_repeat("\t", $depth); |
1040 | 1046 | else |
… |
… |
class Walker_Page extends Walker { |
1042 | 1048 | |
1043 | 1049 | extract($args, EXTR_SKIP); |
1044 | 1050 | $css_class = array('page_item', 'page-item-'.$page->ID); |
| 1051 | |
| 1052 | if( isset( $args['parent_pages'][ $page->ID ] ) ) |
| 1053 | $css_class[] = 'menu-item-parent'; |
| 1054 | |
1045 | 1055 | if ( !empty($current_page) ) { |
1046 | 1056 | $_current_page = get_post( $current_page ); |
1047 | 1057 | if ( in_array( $page->ID, $_current_page->ancestors ) ) |