Skip to content

Instantly share code, notes, and snippets.

@wpexplorer
Last active January 1, 2016 03:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wpexplorer/8086713 to your computer and use it in GitHub Desktop.
Save wpexplorer/8086713 to your computer and use it in GitHub Desktop.
Add a shopping cart icon to WooCommerce products menu item in the WP 3.8 dashboard
// Remove WooCommerce menu.css on WP 3.8+
add_action( 'admin_print_styles', 'wpex_remove_woocommerce_admin_menu_styles' );
if ( ! function_exists('wpex_remove_woocommerce_admin_menu_styles') ) {
function wpex_remove_woocommerce_admin_menu_styles() {
global $wp_version;
if ( $wp_version >= 3.8 ) {
wp_dequeue_style( 'woocommerce_admin_menu_styles' );
}
}
}
// Change WooCommerce Menu icon on WP 3.8+
add_action('woocommerce_register_post_type_product','wpex_change_product_dashicon');
if ( ! function_exists('wpex_change_product_dashicon') ) {
function wpex_change_product_dashicon($array) {
global $wp_version;
if ( $wp_version >= 3.8 ) {
$menu_icon = array(
'menu_icon' => 'dashicons-cart',
);
$array = array_merge($array, $menu_icon);
}
return $array;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment