Move plugin.php and readme

This commit is contained in:
Paul Sealock 2022-06-07 15:55:26 +12:00
parent b17e51fde8
commit 475521ea0b
3 changed files with 47 additions and 0 deletions

View File

@ -61,6 +61,53 @@ function _wc_beta_tester_bootstrap() {
add_action( 'admin_init', array( 'WC_Beta_Tester', 'instance' ) );
}
// Load admin
require( 'plugin.php' );
}
add_action( 'plugins_loaded', '_wc_beta_tester_bootstrap' );
/**
* Register the JS.
*/
function add_extension_register_script() {
$script_path = '/build/index.js';
$script_asset_path = dirname( __FILE__ ) . '/build/index.asset.php';
$script_asset = file_exists( $script_asset_path )
? require( $script_asset_path )
: array( 'dependencies' => array(), 'version' => filemtime( $script_path ) );
$script_url = plugins_url( $script_path, __FILE__ );
wp_register_script(
'woocommerce-admin-test-helper',
$script_url,
$script_asset['dependencies'],
$script_asset['version'],
true
);
wp_enqueue_script( 'woocommerce-admin-test-helper' );
$css_file_version = filemtime( dirname( __FILE__ ) . '/build/index.css' );
wp_register_style(
'wp-components',
plugins_url( 'dist/components/style.css', __FILE__ ),
array(),
$css_file_version
);
wp_register_style(
'woocommerce-admin-test-helper',
plugins_url( '/build/index.css', __FILE__ ),
// Add any dependencies styles may have, such as wp-components.
array(
'wp-components'
),
$css_file_version
);
wp_enqueue_style( 'woocommerce-admin-test-helper' );
}
add_action( 'admin_enqueue_scripts', 'add_extension_register_script' );