Handle current menu item classes for post pages. props filosofo, fixes #13543.

git-svn-id: https://develop.svn.wordpress.org/trunk@14923 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2010-05-26 02:38:31 +00:00
parent 5f9f3b6050
commit 46d962dfb8
1 changed files with 2 additions and 0 deletions

View File

@ -306,6 +306,7 @@ function _wp_menu_item_classes_by_context( &$menu_items = array() ) {
$active_parent_item_ids = array();
$active_parent_object_ids = array();
$possible_object_parents = array();
$home_page_id = (int) get_option( 'page_for_posts' );
if ( $wp_query->is_singular && ! empty( $queried_object->post_type ) && ! is_post_type_hierarchical( $queried_object->post_type ) ) {
foreach ( (array) get_object_taxonomies( $queried_object->post_type ) as $taxonomy ) {
@ -332,6 +333,7 @@ function _wp_menu_item_classes_by_context( &$menu_items = array() ) {
} elseif (
$menu_item->object_id == $queried_object_id &&
(
( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id = $menu_item->object_id ) ||
( 'post_type' == $menu_item->type && $wp_query->is_singular ) ||
( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) )
)