$submenu_item ) { if ( 'woodash' === $submenu_item[2] ) { $woodash_key = $submenu_key; break; } } if ( ! $woodash_key ) { return; } $dashmenu = $submenu['woocommerce'][ $woodash_key ]; $dashmenu[2] = 'admin.php?page=woodash#/'; unset( $submenu['woocommerce'][ $woodash_key ] ); array_unshift( $submenu['woocommerce'], $dashmenu ); $submenu['woodash#/analytics'][0][0] = __( 'Overview', 'woo-dash' ); } // priority is 20 to run after https://github.com/woocommerce/woocommerce/blob/a55ae325306fc2179149ba9b97e66f32f84fdd9c/includes/admin/class-wc-admin-menus.php#L165 add_action( 'admin_head', 'woo_dash_link_structure', 20 ); /** * Load the assets on the Dashboard page */ function woo_dash_enqueue_script(){ if ( ! woo_dash_is_admin_page() ) { return; } wp_enqueue_script( WOO_DASH_APP ); wp_enqueue_style( WOO_DASH_APP ); } add_action( 'admin_enqueue_scripts', 'woo_dash_enqueue_script' ); function woo_dash_admin_body_class( $admin_body_class = '' ) { global $hook_suffix; if ( ! woo_dash_is_admin_page() ) { return $admin_body_class; } $classes = explode( ' ', trim( $admin_body_class ) ); $classes[] = 'woocommerce-page'; $admin_body_class = implode( ' ', array_unique( $classes ) ); return " $admin_body_class "; } add_filter( 'admin_body_class', 'woo_dash_admin_body_class' ); function woo_dash_admin_before_notices() { if ( ! woo_dash_is_admin_page() ) { return; } echo '