add_action( 'admin_menu', array($this, 'admin_menu'), 100 );
public function admin_menu() {
$page = add_submenu_page( 'edit.php?post_type=product', __( 'ajaxmain' ), __( 'ajaxmainagain' ), apply_filters( 'woocommerce_csv_product_role', 'manage_woocommerce' ), 'ajaxmain-product', array( $this, 'output' ) );
}
public function output() {
include( 'ajaxmain.php' );
}
i have attached 2 screenshots. it goes and adds ajaxmainagain to the submenu. when i click on it, it loads ajaxmain.php. however it fails to load stylesheets, scripts. the scripts and stylesheets are in the same directory as ajaxmain.php. it is looking for scripts and stylesheets in wp-admin directory. thanks for the help. unable to find resource http://localhost/wordpress/wp-admin/ajax1.php?stateofmachine=xm234jq&q=2. the resource is in plugins directory.
You need to load your style/script like this.
and with this plugin_url you will get the path till your plugin directory like eg. http://localhost/wordpress/wp-content/plugins/sample-plugin/