1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2024-12-22 20:03: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:
Mikkel Breum 2013-04-07 22:56:08 +02:00
parent 68da31e4be
commit 403ef654ea

View file

@ -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