This is my function to load the bootstrap files.
function load_js()
{
wp_register_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', 'jquery', false, true );
wp_enqueue_script('bootstrap');
}
add_action('wp_enqueue_scripts', 'load_js');
I would expect this to route to:
/wp-content/themes/themename/js/bootstrap.min.js
But instead it does:
/wp-content/themes/themenamejs/bootstrap.min.js
This is my function to load the bootstrap files.
function load_js()
{
wp_register_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', 'jquery', false, true );
wp_enqueue_script('bootstrap');
}
add_action('wp_enqueue_scripts', 'load_js');
I would expect this to route to:
http://site.test/wp-content/themes/themename/js/bootstrap.min.js
But instead it does:
http://site.test/wp-content/themes/themenamejs/bootstrap.min.js
Share Improve this question edited Nov 17, 2019 at 14:20 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Nov 17, 2019 at 9:01 FraserFraser 211 bronze badge1 Answer
Reset to default 2function load_js()
{
wp_register_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), false, true );
wp_enqueue_script('bootstrap');
}
add_action('wp_enqueue_scripts', 'load_js');
Use with array('jquery')
instead of 'jquery'
Refference here. It says: use array.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744996995a4605254.html
评论列表(0条)