You could run a couple checks and enqueue jquery if it’s not registered or enqueued using wp_script_is
function bootstrap_script_init() {
// Check to see if jQuery is registered, if not, register it.
// You can use the local version of WP's jQuery if you want instead of Google's API.
if ( !wp_script_is( 'jquery', 'registered' ) ){
wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js', array(), '3.2.1', true );
}
// Check to see if it is enqueued, if not, enqueue it.
if ( !wp_script_is( 'jquery', 'enqueued' ) ){
wp_enqueue_script( 'jquery' );
}
wp_register_script('bootstrap', get_template_directory_uri(). '/js/bootstrap.min.js', array('jquery'), '3.3.7', true);
wp_enqueue_script('bootstrap');
}
add_action( 'wp_enqueue_scripts', 'bootstrap_script_init' );
Related Posts:
- Correct Method to run scripts with dependencies without enqueue?
- How to prevent wordpress from loading old versions of jquery in wp_head();?
- How to get a jQuery script to run on a page?
- Including javascript for a shortcode
- WordPress Script Loading/Unloading — wp_deregister_script(‘jquery’)
- How to properly add Bootstrap and JQuery Javascripts?
- How to add unique image class to WordPress
- Disable Cloudflare Rocket Loader for jQuery javascript and make it load first
- Using jquery with wordpress using wp_enqueue_scripts
- WP_ENQUEUE not working with Foundation 5
- How to use script in WordPress installation?
- JQuery Login Dropdown not functioning in theme
- How to deregister scripts all at once
- Javascript block in Twenty Twelve theme
- jQuery functions work in console, but not live
- Why is jQuery not working properly? [closed]
- Should I use .done() and .fail() for new jQuery AJAX code instead of success and error
- Pass request headers in a jQuery AJAX GET call
- jQuery set checkbox checked
- JavaScript runtime error: ‘$’ is undefined
- JavaScript Loading Screen while page loads
- jQuery if checkbox is checked
- Jquery .on(‘scroll’) not firing the event while scrolling
- Simple throttle in JavaScript
- Run ScrollTop with offset of element by ID
- Form Submit jQuery does not work
- jQuery multiple events to trigger the same function
- Using jquery to get all checked checkboxes with a certain class name
- How do I remove a box-shadow effect from an element when another element is hovered?
- jQuery delay not working
- How to save the state of a drag and drop jQuery UI Sortables front end layout editor?
- Display Media Uploader in Own Plugin on WordPress 3.5
- What is the simplest ajax upload plugin or script to be used with wordpress?
- Add tinymce buttons to caption textarea in media uploader
- How to get the path to current theme, but from a JS file?
- How to handle multiple instance of “send_to_editor” js function
- How do I use WP’s jQuery
- Add X meta box inputs based on form at top of meta box, how to do it right?
- Stylizing external SVG files with jQuery and CSS
- wp_enqueuescript won’t load in footer even with true value set?
- jQuery Ajax() doesn’t work when the page is accessed as a WordPress template page
- WordPress REST endpoint not able to reach with jQuery
- Is placing stuff in page text edit window bad form?
- Add colorpicker to featured image
- Googles jQuery: Are There Avantages to Using It?
- Passing JSON-encoded HTML from WordPress to JavaScript
- Tags in WordPress 3.2
- php ajax problem – weird 301 responses!
- Create URL with parameter for JQuery toggle status
- Stop theme’s jQuery function from running
- Making the wordpress login form a jQuery dropdown
- WordPress Ajax problem with undefined url
- Use Media Uploader on Multiple Images on same page
- Add a class to posts in increments of 2
- Move jQuery to the bottom of the page whilst keeping the WordPress jQuery
- Intergrating agile carousel to wordpress: how to write the ajax_callback function
- How can I fire a jQuery event once getBlocks() actually returns the post’s blocks instead of null?
- WP UI style within shortcode – Any Suggestions?
- wp_dequeue_script not working in my plugin
- Trouble adding inline style after jQuery in the footer!
- Reload wordpress shortcodes
- jQuery script isn’t posting to database
- $.browser Undefined Seemingly Causing Faulty Page Display
- I’m trying to set the cookie to my site to button on click action ,it is working on when user logged in .When user logged out it’s not working
- Ajax form submit not working, returns 0
- Invoking Jquery in a Plugin
- Why not working jquery show() function in wordpress? [closed]
- Loading scripts on a single page plants the script in the footer
- registering new jQuery after wp_deregister_script() not working
- Displaying an image’s alt title and caption inside a fancybox window. Working, but showing the same alt and caption for each image
- jQuery Show DIV and Remove Button [closed]
- timeouts (ERR_CONNECTION_RESET) on seemingly random files after upgrading to HTTPS
- How to call custom jQuery plugins into the customizer controls
- Change zurb foundation top bar style on.scroll in wordpress theme using jquery and css
- how to use wp_editor() here am getting empty result
- jQuery is not defined, working on local server but not online
- Save jQuery UI Sortable on WordPress
- Problem adding MP3 attachments to a jPlayer playlist
- problems with jquery external rss feed integration
- wp_enqueue_script jquery and jquery ui not working
- A carousel slideshow plugin in JavaScript
- Axis guidelines over an image
- $ not defined using jQuery in WordPress
- WordPress forbidden 403 on delete in production vs local environment
- jquery Autocomplete
- Get ajaxForm response value
- Update a parent theme JQuery property in the child theme
- jQuery search function not running in WordPress but running locally (fiddle)
- Refresh widget admin page resetting jQuery hidden class
- Autocomplete for titles via ajax – rework of past post away from like_escape()
- Can’t seem to get JQuery working (wordpress plugin)
- Ajax Request with jQuery not happening
- Console shows ReferenceError: jQuery is not defined, no clue why!
- Sorting UL Listing Within the TinyMCE Visual Editor in WordPress
- jQuery .change() Event Bubbling in WP Admin
- My .js file is getting a 404
- Combo box populating a DIV using ajax/jquery
- how to display post in jquery slider and carousel
- Carousel Hover Image
- What is calling jquery?