Add to the tools menu

This commit is contained in:
Rebecca Scott 2021-02-23 15:30:49 +10:00
parent 92ce7467e5
commit 8a3afd8157
3 changed files with 28 additions and 6 deletions

2
.gitignore vendored
View File

@ -21,3 +21,5 @@ wp-cli.local.yml
# Composer
/vendor/
*.swp

12
plugin.php Normal file
View File

@ -0,0 +1,12 @@
<?php
add_action( 'admin_menu', function() {
add_management_page(
'WooCommerce Admin Test Helper',
'WCA Test Helper',
'install_plugins',
'woocommerce-admin-test-helper',
function() {
?><div id="woocommerce-admin-test-helper">YEAAAAA</div><?php
}
);
} );

View File

@ -1,8 +1,13 @@
<?php
/**
* Plugin Name: woocommerce-admin-test-helper
* Plugin Name: WooCommerce Admin Test Helper
* Plugin URI: https://github.com/woocommerce/woocommerce-admin-test-helper
* Description: A helper plugin to assist with testing WooCommerce Admin
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Version: 0.1.0-dev
*
* @package WooCommerce\Admin
* @package WooCommerce\Admin\TestHelper
*/
/**
@ -21,7 +26,7 @@ function add_extension_register_script() {
$script_url = plugins_url( $script_path, __FILE__ );
wp_register_script(
'wca-test-helper',
'woocommerce-admin-test-helper',
$script_url,
$script_asset['dependencies'],
$script_asset['version'],
@ -29,15 +34,18 @@ function add_extension_register_script() {
);
wp_register_style(
'wca-test-helper',
'woocommerce-admin-test-helper',
plugins_url( '/build/index.css', __FILE__ ),
// Add any dependencies styles may have, such as wp-components.
array(),
filemtime( dirname( __FILE__ ) . '/build/index.css' )
);
wp_enqueue_script( 'wca-test-helper' );
wp_enqueue_style( 'wca-test-helper' );
wp_enqueue_script( 'woocommerce-admin-test-helper' );
wp_enqueue_style( 'woocommerce-admin-test-helper' );
}
add_action( 'admin_enqueue_scripts', 'add_extension_register_script' );
// Load the plugin
require( 'plugin.php' );