Fixed highlighting in admin menu for post type add screens. Closes #836.

This commit is contained in:
Coen Jacobs 2012-03-19 20:29:04 +01:00
parent 54730605d0
commit 054ca44c63
1 changed files with 18 additions and 0 deletions

View File

@ -34,6 +34,24 @@ function woocommerce_admin_menu() {
foreach ($print_css_on as $page) add_action( 'admin_print_styles-'. $page, 'woocommerce_admin_css' );
}
/**
* Highlights the correct top level admin menu item for post type add screens.
*/
add_action( 'admin_head', 'woocommerce_admin_menu_highlight' );
function woocommerce_admin_menu_highlight() {
global $parent_file, $submenu_file, $post_type;
$to_highlight = array( 'shop_order', 'shop_coupon' );
if ( isset( $post_type ) ) {
if ( in_array( $post_type, $to_highlight ) ) {
$submenu_file = 'edit.php?post_type=' . $post_type;
$parent_file = 'woocommerce';
}
}
}
/**
* Admin Notices
*/