mirror of
https://github.com/inretio/WordPress-Plugin-Boilerplate
synced 2024-12-22 11:53:53 +02:00
Removed the need to customize url for wp_enqueue_style and wp_enqueue_scripts
By adding the __FILE__ magic constant as a second parameter to the wp_enqueue_style and wp_enqueue_scripts, the user no longer needs to change 'plugin-name'. This also makes the code more robust.
This commit is contained in:
parent
68da31e4be
commit
403ef654ea
1 changed files with 2 additions and 4 deletions
|
@ -135,8 +135,7 @@ class PluginName {
|
|||
*/
|
||||
public function register_plugin_styles() {
|
||||
|
||||
// TODO: Change 'plugin-name' to the name of your plugin
|
||||
wp_enqueue_style( 'plugin-name-plugin-styles', plugins_url( 'plugin-name/css/display.css' ) );
|
||||
wp_enqueue_style( 'plugin-name-plugin-styles', plugins_url( 'css/display.css', __FILE__ ) );
|
||||
|
||||
} // end register_plugin_styles
|
||||
|
||||
|
@ -145,8 +144,7 @@ class PluginName {
|
|||
*/
|
||||
public function register_plugin_scripts() {
|
||||
|
||||
// TODO: Change 'plugin-name' to the name of your plugin
|
||||
wp_enqueue_script( 'plugin-name-plugin-script', plugins_url( 'plugin-name/js/display.js' ), array('jquery') );
|
||||
wp_enqueue_script( 'plugin-name-plugin-script', plugins_url( 'js/display.js', __FILE__ ), array('jquery') );
|
||||
|
||||
} // end register_plugin_scripts
|
||||
|
||||
|
|
Loading…
Reference in a new issue