当前位置: 动力学知识库 > 问答 > 编程问答 >

php - wp_enqueue_scripts is not working

问题描述:

I copied everything exactly like in WordPress Codex but I don't know what's wrong that it doesn't work. This is the portion from function.php.

What am I missing?

define('JS_PATH', get_template_directory_uri() . '/resources/js');

<?php

add_action('wp_enqueue_scripts', 'enqueue_and_register_my_scripts');

function enqueue_and_register_my_scripts() {

/* Remove JQuery */

wp_deregister_script( 'jquery' );

/* wp_register_script('custom script name', 'source', 'is it dependent', 'version', 'place at the bottom of footer'); */

wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', false, '1.11.0', FALSE);

wp_register_script('bootstrap', JS_PATH . '/bootstrap.js', 'jquery', '1.0', FALSE);

wp_register_script('datepicker', JS_PATH . '/datepicker.js', 'bootstrap', '1.0', FALSE);

wp_register_script('application', JS_PATH . '/application.js', 'jquery', '1.0', FALSE);

wp_enqueue_script('jquery');

wp_enqueue_script('bootstrap');

wp_enqueue_script('application');

}

?>

网友答案:

Found the solution, the problem was that I was not including <?php wp_footer(); ?> in my footer.php

分享给朋友:
您可能感兴趣的文章:
随机阅读: