mirror of
https://github.com/inretio/WordPress-Plugin-Boilerplate
synced 2024-12-23 04:13:53 +02:00
parent
626a161581
commit
791920143e
1 changed files with 288 additions and 270 deletions
|
@ -26,6 +26,22 @@ License:
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following constant is used to define a constant for this plugin to make it
|
||||||
|
* easier to provide cache-busting functionality on loading stylesheets
|
||||||
|
* and JavaScript.
|
||||||
|
*
|
||||||
|
* After you've defined these constants, do a find/replace on the constants
|
||||||
|
* used throughout the rest of this file.
|
||||||
|
*/
|
||||||
|
// TODO: Replace 'PLUGIN_NAME' wih the name of your class
|
||||||
|
if ( ! defined('PLUGIN_NAME_VERSION' ) ) {
|
||||||
|
|
||||||
|
// TODO: Make sure that this version correspondings to the value in the 'Version' in the header
|
||||||
|
define( 'PLUGIN_NAME_VERSION', '1.0.0' );
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO:
|
* TODO:
|
||||||
*
|
*
|
||||||
|
@ -45,6 +61,7 @@ class PluginName {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refers to a single instance of this class.
|
* Refers to a single instance of this class.
|
||||||
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @var object
|
* @var object
|
||||||
*/
|
*/
|
||||||
|
@ -52,6 +69,7 @@ class PluginName {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refers to the slug of the plugin screen.
|
* Refers to the slug of the plugin screen.
|
||||||
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -183,7 +201,7 @@ class PluginName {
|
||||||
|
|
||||||
$screen = get_current_screen();
|
$screen = get_current_screen();
|
||||||
if ( $screen->id == $this->plugin_screen_slug ) {
|
if ( $screen->id == $this->plugin_screen_slug ) {
|
||||||
wp_enqueue_style( 'plugin-name-admin-styles', plugins_url( 'css/admin.css', __FILE__ ) );
|
wp_enqueue_style( 'plugin-name-admin-styles', plugins_url( 'css/admin.css', __FILE__ ), PLUGIN_NAME_VERSION );
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
} // end if
|
} // end if
|
||||||
|
@ -211,7 +229,7 @@ class PluginName {
|
||||||
|
|
||||||
$screen = get_current_screen();
|
$screen = get_current_screen();
|
||||||
if ( $screen->id == $this->plugin_screen_slug ) {
|
if ( $screen->id == $this->plugin_screen_slug ) {
|
||||||
wp_enqueue_script( 'plugin-name-admin-script', plugins_url( 'js/admin.js', __FILE__ ), array( 'jquery' ) );
|
wp_enqueue_script( 'plugin-name-admin-script', plugins_url('js/admin.js', __FILE__), array( 'jquery' ), PLUGIN_NAME_VERSION );
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
} // end if
|
} // end if
|
||||||
|
@ -219,21 +237,21 @@ class PluginName {
|
||||||
} // end register_admin_scripts
|
} // end register_admin_scripts
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers and enqueues plugin-specific styles.
|
* Registers and enqueues public-facing stylesheets.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function register_plugin_styles() {
|
public function register_plugin_styles() {
|
||||||
wp_enqueue_style( 'plugin-name-plugin-styles', plugins_url( 'css/display.css', __FILE__ ) );
|
wp_enqueue_style( 'plugin-name-plugin-styles', plugins_url( 'css/display.css', __FILE__ ), PLUGIN_NAME_VERSION );
|
||||||
} // end register_plugin_styles
|
} // end register_plugin_styles
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers and enqueues plugin-specific scripts.
|
* Registers and enqueues public-facing JavaScript.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function register_plugin_scripts() {
|
public function register_plugin_scripts() {
|
||||||
wp_enqueue_script( 'plugin-name-plugin-script', plugins_url( 'js/display.js', __FILE__ ), array( 'jquery' ) );
|
wp_enqueue_script( 'plugin-name-plugin-script', plugins_url( 'js/display.js', __FILE__ ), array( 'jquery' ), PLUGIN_NAME_VERSION );
|
||||||
} // end register_plugin_scripts
|
} // end register_plugin_scripts
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue