Merge pull request #773 from piffpaffpuff/master

menu icons when no manage_woocommerce capability
This commit is contained in:
Mike Jolley 2012-03-12 00:09:18 -07:00
commit 3b74269ed2
7 changed files with 81 additions and 5 deletions

View File

@ -21,7 +21,7 @@ function woocommerce_admin_menu() {
if ( current_user_can( 'manage_woocommerce' ) ) $menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' );
$main_page = add_menu_page(__('WooCommerce', 'woocommerce'), __('WooCommerce', 'woocommerce'), 'manage_woocommerce', 'woocommerce' , 'woocommerce_settings_page', $woocommerce->plugin_url() . '/assets/images/icons/menu_icon_wc.png', 55);
$main_page = add_menu_page(__('WooCommerce', 'woocommerce'), __('WooCommerce', 'woocommerce'), 'manage_woocommerce', 'woocommerce' , 'woocommerce_settings_page', null, 55);
add_submenu_page('woocommerce', __('WooCommerce Settings', 'woocommerce'), __('Settings', 'woocommerce') , 'manage_woocommerce', 'woocommerce', 'woocommerce_settings_page');
$reports_page = add_submenu_page('woocommerce', __('Reports', 'woocommerce'), __('Reports', 'woocommerce') , 'view_woocommerce_reports', 'woocommerce_reports', 'woocommerce_reports_page');
add_submenu_page('edit.php?post_type=product', __('Attributes', 'woocommerce'), __('Attributes', 'woocommerce'), 'manage_woocommerce_products', 'woocommerce_attributes', 'woocommerce_attributes_page');
@ -37,7 +37,7 @@ function woocommerce_admin_menu() {
/**
* Admin Notices
*/
add_action( "admin_print_styles", 'woocommerce_admin_notices_styles' );
add_action( 'admin_print_styles', 'woocommerce_admin_notices_styles' );
function woocommerce_admin_install_notice() {
?>
@ -304,6 +304,17 @@ function woocommerce_admin_css() {
do_action('woocommerce_admin_css');
}
/**
* Queue admin menu icons CSS
*
*/
function woocommerce_admin_menu_styles() {
global $woocommerce;
wp_enqueue_style( 'woocommerce_admin_menu_styles', $woocommerce->plugin_url() . '/assets/css/menu.css' );
}
add_action( 'admin_print_styles', 'woocommerce_admin_menu_styles' );
/**
* Order admin menus
*/

28
assets/css/menu.css Normal file
View File

@ -0,0 +1,28 @@
/* Menu */
#adminmenu div.wp-menu-image img {
display: none;
}
#adminmenu #menu-posts-product div.wp-menu-image {
background: transparent url(../images/icons/menu_icons.png) no-repeat -32px -32px;
}
#adminmenu #menu-posts-product.wp-menu-open div.wp-menu-image, #adminmenu #menu-posts-product:hover div.wp-menu-image {
background-position: -32px 0px;
}
#adminmenu #menu-posts-shop_order div.wp-menu-image {
background: transparent url(../images/icons/menu_icons.png) no-repeat -64px -32px;
}
#adminmenu #menu-posts-shop_order.wp-menu-open div.wp-menu-image, #adminmenu #menu-posts-shop_order:hover div.wp-menu-image {
background-position: -64px 0px;
}
#adminmenu #menu-posts-shop_coupon div.wp-menu-image {
background: transparent url(../images/icons/menu_icons.png) no-repeat -96px -32px;
}
#adminmenu #menu-posts-shop_coupon.wp-menu-open div.wp-menu-image, #adminmenu #menu-posts-shop_coupon:hover div.wp-menu-image {
background-position: -96px 0px;
}
#adminmenu #toplevel_page_woocommerce div.wp-menu-image {
background: transparent url(../images/icons/menu_icons.png) no-repeat 0px -32px;
}
#adminmenu #toplevel_page_woocommerce.wp-menu-open div.wp-menu-image, #adminmenu #toplevel_page_woocommerce:hover div.wp-menu-image {
background-position: 0px 0px;
}

38
assets/css/menu.less Normal file
View File

@ -0,0 +1,38 @@
/* Menu */
#adminmenu {
div.wp-menu-image img {
display: none;
}
#menu-posts-product {
div.wp-menu-image {
background: transparent url(../images/icons/menu_icons.png) no-repeat -32px -32px;
}
&.wp-menu-open div.wp-menu-image, &:hover div.wp-menu-image {
background-position: -32px 0px;
}
}
#menu-posts-shop_order {
div.wp-menu-image {
background: transparent url(../images/icons/menu_icons.png) no-repeat -64px -32px;
}
&.wp-menu-open div.wp-menu-image, &:hover div.wp-menu-image {
background-position: -64px 0px;
}
}
#menu-posts-shop_coupon {
div.wp-menu-image {
background: transparent url(../images/icons/menu_icons.png) no-repeat -96px -32px;
}
&.wp-menu-open div.wp-menu-image, &:hover div.wp-menu-image {
background-position: -96px 0px;
}
}
#toplevel_page_woocommerce {
div.wp-menu-image {
background: transparent url(../images/icons/menu_icons.png) no-repeat 0px -32px;
}
&.wp-menu-open div.wp-menu-image, &:hover div.wp-menu-image {
background-position: 0px 0px;
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -703,8 +703,7 @@ class Woocommerce {
'query_var' => true,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields' ),
'has_archive' => $base_slug,
'show_in_nav_menus' => false,
'menu_icon' => $this->plugin_url() . '/assets/images/icons/menu_icon_products.png'
'show_in_nav_menus' => false
)
);
@ -832,7 +831,7 @@ class Woocommerce {
'rewrite' => false,
'query_var' => false,
'supports' => array( 'title' ),
'show_in_nav_menus' => false,
'show_in_nav_menus' => false
)
);
}