Problems loading scripts in WordPress -
i working on first plugin , coming along alright. however, not able load scripts (css , js) plugin. code:
function my_scripts() { wp_enqueue_style('my-style', plugins_url( 'my-plugin/my-style.css') ); wp_enqueue_script( 'my-js', plugins_url( 'my-plugin/my-js.js' ), array('jquery'), '', true ); } add_action( 'wp_enqueue_scripts', 'my_scripts' );
i must missing something... such simple code not working :(
your code looks pretty correct, check out plugins url page , see particular part:
if using plugins_url() function in file nested inside subdirectory of plugin directory, should use php's dirname() function
basically, need load this:
plugins_url( 'my-plugin/my-js.js' , __file__ ),
Comments
Post a Comment