Ticket #13977: recognize-home-link-with-index.13977.diff
File recognize-home-link-with-index.13977.diff, 1.2 KB (added by , 14 years ago) |
---|
-
wp-includes/nav-menu-template.php
351 351 } elseif ( 'custom' == $menu_item->object ) { 352 352 $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 353 353 $item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url; 354 if ( $item_url == $current_url ) { 354 $_indexless_current = preg_replace( '/index.php$/', '', $current_url ); 355 356 if ( in_array( $item_url, array( $current_url, $_indexless_current ) ) ) { 355 357 $classes[] = 'current-menu-item'; 356 358 $_anc_id = (int) $menu_item->db_id; 357 359 … … 362 364 $active_ancestor_item_ids[] = $_anc_id; 363 365 } 364 366 365 if ( untrailingslashit($current_url) == home_url() ) {367 if ( in_array( home_url(), array( untrailingslashit( $current_url ), untrailingslashit( $_indexless_current ) ) ) ) { 366 368 $classes[] = 'menu-item-home'; 367 369 // Back compat for home limk to match wp_page_menu() 368 370 $classes[] = 'current_page_item';