I would like to make use of WordPress with Bootstrap however WordPress doesn’t load jQuery correctly so I get this error message:
Uncaught TypeError: Bootstrap’s JavaScript requires jQuery. jQuery should be included earlier than Bootstrap’s JavaScript.
That is from my features.php:
operate add_theme_scripts() {
wp_enqueue_style('bootstrap', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css');
wp_enqueue_style('fashion', get_theme_file_path() . '/fashion.css');
wp_enqueue_script('jquery');
wp_enqueue_script('Popper', 'https://cdn.jsdelivr.web/npm/popper.js@1.16.0/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() . '/belongings/js/script.js', array('jquery', 'Popper', 'Bootstrap'), null, true);
}
add_action('wp_enqueue_scripts', 'add_theme_scripts');
May you please assist me with this subject? Thanks quite a bit upfront