Check custom links, including a home link, against the current URL to see if we should add current-menu-item. props ptahdunbar, fixes #13213, see #13220.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8ff9331f75
commit
d63a41ca15
|
@ -72,11 +72,16 @@ class Walker_Nav_Menu extends Walker {
|
|||
|
||||
$classes = array( 'menu-item', 'menu-item-type-'. $item->type, $item->classes );
|
||||
|
||||
if ( 'custom' != $item->object )
|
||||
if ( 'custom' == $item->object ) {
|
||||
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
$item_url = strpos( $item->url, '#' ) ? substr( $item->url, 0, strpos( $item->url, '#' ) ) : $item->url;
|
||||
if ( $item_url == $current_url )
|
||||
$classes[] = 'current-menu-item';
|
||||
} else {
|
||||
$classes[] = 'menu-item-object-'. $item->object;
|
||||
|
||||
if ( $item->object_id == $wp_query->get_queried_object_id() )
|
||||
$classes[] = 'current-menu-item';
|
||||
}
|
||||
|
||||
// @todo add classes for parent/child relationships
|
||||
|
||||
|
|
Loading…
Reference in New Issue