Fixed admin menu highlighting (also custom taxes). Closes #993

This commit is contained in:
Coen Jacobs 2012-05-04 11:20:56 +02:00
parent cee85cb443
commit b40e072438
1 changed files with 8 additions and 8 deletions

View File

@ -49,21 +49,21 @@ add_action( 'admin_head', 'woocommerce_admin_menu_highlight' );
function woocommerce_admin_menu_highlight() { function woocommerce_admin_menu_highlight() {
global $parent_file, $submenu_file, $self, $post_type, $taxonomy; global $parent_file, $submenu_file, $self, $post_type, $taxonomy;
$to_highlight = array( 'shop_order', 'shop_coupon' ); $to_highlight_types = array( 'shop_order', 'shop_coupon' );
if ( isset( $post_type ) ) { if ( isset( $post_type ) ) {
if ( in_array( $post_type, $to_highlight ) ) { if ( in_array( $post_type, $to_highlight_types ) ) {
$submenu_file = 'edit.php?post_type=' . $post_type; $submenu_file = 'edit.php?post_type=' . $post_type;
$parent_file = 'woocommerce'; $parent_file = 'woocommerce';
} }
$screen = get_current_screen(); if ( 'product' == $post_type ) {
$screen = get_current_screen();
$not_replace = array( 'product_shipping_class', 'product_cat', 'product_tag' ); if ( $screen->base == 'edit-tags' && 'pa_' == substr( $taxonomy, 0, 3 ) ) {
$submenu_file = 'woocommerce_attributes';
if ( $screen->base == 'edit-tags' && ! in_array( $taxonomy, $not_replace ) ) { $parent_file = 'edit.php?post_type=' . $post_type;
$submenu_file = 'woocommerce_attributes'; }
$parent_file = 'edit.php?post_type=' . $post_type;
} }
} }
} }