I have a an existing set of WooCommerce plugins, the plugins that allow a user to enter product details, some of you may be familiar. I've made a new plugin that I'd like to add as a sub-menu in the existing menu structure.
Class WC_Batch_Category_Import_Plugin {
static $instance;
public function __construct() {
add_action( 'admin_menu', array( $this, 'plugin_menu' ), 99 );
}
public function plugin_menu() {
$hook = add_submenu_page(
'edit.php?post_type=product',
'Batch Category Import',
'Batch Category Import',
'manage_woocommerce',
'batch-category-import'
);
add_action( "load-$hook" );
}
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
}
add_action( 'plugins_loaded', __construct() () {
WC_Batch_Category_Import_Plugin::get_instance();
} );
I have the following code, although with this code in the plugin, the menu is not being displayed. Does anyone know why? Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire