| | 361 | // Allow plugin to force selection |
| | 362 | } elseif ( apply_filters( 'nav_menu_selected', false, $menu_item ) ) { |
| | 363 | $classes[] = 'current-menu-item'; |
| | 364 | $menu_items[$key]->current = true; |
| | 365 | $_anc_id = (int) $menu_item->db_id; |
| | 366 | |
| | 367 | while( |
| | 368 | ( $_anc_id = get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) ) && |
| | 369 | ! in_array( $_anc_id, $active_ancestor_item_ids ) |
| | 370 | ) { |
| | 371 | $active_ancestor_item_ids[] = $_anc_id; |
| | 372 | } |
| | 373 | |
| | 374 | if ( in_array( home_url(), array( untrailingslashit( $current_url ), untrailingslashit( $_indexless_current ) ) ) ) { |
| | 375 | // Back compat for home link to match wp_page_menu() |
| | 376 | $classes[] = 'current_page_item'; |
| | 377 | } |
| | 378 | $active_parent_item_ids[] = (int) $menu_item->menu_item_parent; |
| | 379 | $active_parent_object_ids[] = (int) $menu_item->post_parent; |
| | 380 | $active_object = $menu_item->object; |
| | 381 | |
| | 382 | if ( untrailingslashit($item_url) == home_url() ) |
| | 383 | $classes[] = 'menu-item-home'; |