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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -