diff --git a/admin/woocommerce-admin-init.php b/admin/woocommerce-admin-init.php index 1a10bde2ba1..fc6dcb1b7ee 100644 --- a/admin/woocommerce-admin-init.php +++ b/admin/woocommerce-admin-init.php @@ -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 */ diff --git a/assets/css/menu.css b/assets/css/menu.css new file mode 100644 index 00000000000..7043c967059 --- /dev/null +++ b/assets/css/menu.css @@ -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; +} diff --git a/assets/css/menu.less b/assets/css/menu.less new file mode 100644 index 00000000000..eaefc833aa9 --- /dev/null +++ b/assets/css/menu.less @@ -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; + } + } +} \ No newline at end of file diff --git a/assets/images/icons/menu_icon_products.png b/assets/images/icons/menu_icon_products.png deleted file mode 100644 index 22048afa0fd..00000000000 Binary files a/assets/images/icons/menu_icon_products.png and /dev/null differ diff --git a/assets/images/icons/menu_icon_wc.png b/assets/images/icons/menu_icon_wc.png deleted file mode 100644 index 575045c0f85..00000000000 Binary files a/assets/images/icons/menu_icon_wc.png and /dev/null differ diff --git a/assets/images/icons/menu_icons.png b/assets/images/icons/menu_icons.png index 15524162218..e69049087fa 100644 Binary files a/assets/images/icons/menu_icons.png and b/assets/images/icons/menu_icons.png differ diff --git a/woocommerce.php b/woocommerce.php index 174b486e142..c4a239719f9 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -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 ) ); }