开发者

Wordpress Child Theme & enqueue_script

I'm trying to enqueue a script directly from my child theme's header just after the wp_hook, but for the life of me it's not showing up - what gives?

// register your script location, dependencies and version
   wp_register_script('jqtransform',
   get_bloginfo('stylesheet_directory') . '/includes/jq开发者_开发问答transformplugin/jquery.jqtransform.js', false);
// enqueue the script
   wp_enqueue_script('jqtransform');

Here's the link.


Turns out I needed to add enqueue_script BEFORE the wp_head call, as well as use a different URL path thingamabob. Here's the final code:

function add_my_scripts(){
    wp_register_script('jqtransform', 
    get_bloginfo('stylesheet_directory').'/includes/jqtransform/jquery.jqtransform.js', array('jquery'),'1.0');
    wp_enqueue_script('jqtransform'); 
}
add_action('init', 'add_my_scripts');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜