Menu position fixes

This commit is contained in:
Mike Jolley 2011-09-08 11:03:02 +01:00
parent ab5a86cba9
commit 69526ca9c4
2 changed files with 9 additions and 6 deletions

View File

@ -39,9 +39,9 @@ add_action('admin_print_scripts', 'woocommerce_admin_scripts');
function woocommerce_admin_menu() {
global $menu, $woocommerce;
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator' );
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' );
add_menu_page(__('WooCommerce'), __('WooCommerce'), 'manage_woocommerce', 'woocommerce' , 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/images/icons/menu_icons.png', 56);
add_menu_page(__('WooCommerce'), __('WooCommerce'), 'manage_woocommerce', 'woocommerce' , 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/images/icons/menu_icons.png', 55);
add_submenu_page('woocommerce', __('General Settings', 'woothemes'), __('Settings', 'woothemes') , 'manage_woocommerce', 'woocommerce', 'woocommerce_settings');
add_submenu_page('edit.php?post_type=product', __('Attributes', 'woothemes'), __('Attributes', 'woothemes'), 'manage_woocommerce', 'attributes', 'woocommerce_attributes');
}
@ -54,15 +54,19 @@ function woocommerce_admin_menu_order( $menu_order ) {
// Get the index of our custom separator
$woocommerce_separator = array_search( 'separator-woocommerce', $menu_order );
// Get index of product menu
$woocommerce_product = array_search( 'edit.php?post_type=product', $menu_order );
// Loop through menu order and do some rearranging
foreach ( $menu_order as $index => $item ) :
if ( ( ( 'woocommerce' ) == $item ) ) :
$woocommerce_menu_order[] = 'separator-woocommerce';
$woocommerce_menu_order[] = $item;
$woocommerce_menu_order[] = 'edit.php?post_type=product';
unset( $menu_order[$woocommerce_separator] );
endif;
if ( !in_array( $item, array( 'separator-woocommerce' ) ) ) :
unset( $menu_order[$woocommerce_product] );
elseif ( !in_array( $item, array( 'separator-woocommerce' ) ) ) :
$woocommerce_menu_order[] = $item;
endif;

View File

@ -131,7 +131,6 @@ function woocommerce_post_type() {
'capability_type' => 'post',
'publicly_queryable' => true,
'exclude_from_search' => false,
'menu_position' => 57,
'hierarchical' => true,
'rewrite' => array( 'slug' => $base_slug, 'with_front' => false ),
'query_var' => true,