WordPress does not load jQuery
I'd like to use WordPress with Bootstrap but WordPress does not load jQuery properly so I get this error message:
Uncaught TypeError: Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.
This is from my functions.php:
function add_theme_scripts() {
wp_enqueue_style('bootstrap', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css');
wp_enqueue_style('style', get_theme_file_path() . '/style.css');
wp_enqueue_script('jquery');
wp_enqueue_script('Popper', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js', array('jquery'), null, true);
wp_enqueue_script('Bootstrap', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js', array('jquery', Popper), null, true);
wp_enqueue_script('script', get_theme_file_path() . '/assets/js/script.js', array('jquery', 'Popper', 'Bootstrap'), null, true);
}
add_action('wp_enqueue_scripts', 'add_theme_scripts');
Could you please help me with this issue? Thanks a lot in advance
Topic twitter-bootstrap functions jquery Wordpress
Category Web