Fixed admin highlighting for attribute terms. Closes #934

This commit is contained in:
Coen Jacobs 2012-04-16 17:45:39 +02:00
parent ea15344c9e
commit 214e05ca24
2 changed files with 14 additions and 5 deletions

View File

@ -33,7 +33,7 @@ function woocommerce_attributes() {
$wpdb->insert( $wpdb->prefix . "woocommerce_attribute_taxonomies", array( 'attribute_name' => $attribute_name, 'attribute_label' => $attribute_label, 'attribute_type' => $attribute_type ), array( '%s', '%s' ) );
wp_safe_redirect( get_admin_url() . 'admin.php?page=woocommerce_attributes' );
wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=woocommerce_attributes' );
exit;
endif;
@ -51,7 +51,7 @@ function woocommerce_attributes() {
endif;
wp_safe_redirect( get_admin_url() . 'admin.php?page=woocommerce_attributes' );
wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=woocommerce_attributes' );
exit;
elseif (isset($_GET['delete'])) :
@ -75,7 +75,7 @@ function woocommerce_attributes() {
endif;
wp_safe_redirect( get_admin_url() . 'admin.php?page=woocommerce_attributes' );
wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=woocommerce_attributes' );
exit;
endif;

View File

@ -47,15 +47,24 @@ function woocommerce_admin_menu() {
add_action( 'admin_head', 'woocommerce_admin_menu_highlight' );
function woocommerce_admin_menu_highlight() {
global $parent_file, $submenu_file, $post_type;
global $parent_file, $submenu_file, $self, $post_type, $taxonomy;
$to_highlight = array( 'shop_order', 'shop_coupon' );
if ( isset( $post_type ) ) {
if ( in_array( $post_type, $to_highlight ) ) {
if ( in_array( $post_type, $to_highlight ) ) {
$submenu_file = 'edit.php?post_type=' . $post_type;
$parent_file = 'woocommerce';
}
$screen = get_current_screen();
$not_replace = array( 'product_shipping_class', 'product_cat', 'product_tag' );
if ( $screen->base == 'edit-tags' && ! in_array( $taxonomy, $not_replace ) ) {
$submenu_file = 'woocommerce_attributes';
$parent_file = 'edit.php?post_type=' . $post_type;
}
}
}