Here you go.
add_action('init', 'register_custom_jquery');
function register_custom_jquery() {
wp_deregister_script('jquery');
wp_register_script(
'jquery',
'https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js',
array(),
'1.6.1'
);
wp_register_script(
'my-custom-script',
'http://example.com/js/script.js',
array(),
'1.0'
);
}
add_action('wp_enqueue_scripts', 'add_js_to_page');
function add_js_to_page() {
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'my-custom-script' );
}
Related Posts:
- JavaScript code do not works on online server
- Running javascript in a child theme. Works in jsfiddle
- JavaScript sleep/wait before continuing [duplicate]
- Why does my JavaScript code receive a “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error, while Postman does not?
- How do I link a JavaScript file to a HTML file?
- What does [object Object] mean? (JavaScript)
- Why does my JavaScript code receive a “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error, while Postman does not?
- How to set time delay in javascript
- JavaScript error (Uncaught SyntaxError: Unexpected end of input)
- JavaScript error (Uncaught SyntaxError: Unexpected end of input)
- jQuery equivalent of JavaScript’s addEventListener method
- Adding an onclick function to go to url in JavaScript?
- Checking a Url in Jquery/Javascript
- My javascript is returning this error: $.ajax is not a function
- Best way to store a key=>value array in JavaScript?
- Javascript Runtime error: $ is undefined
- JavaScript: filter() for Objects
- JavaScript runtime error: ‘$’ is undefined
- When and why to ‘return false’ in JavaScript?
- JavaScript Loading Screen while page loads
- Format date to MM/dd/yyyy in JavaScript
- Theme has superfish – how to add supersubs?
- Ajax page load in wordpress the right way?
- Jquery not working
- A carousel slideshow plugin in JavaScript
- JS behavior differs depending on page tree [closed]
- How to load Javascript code or functions.php later in a child theme?
- I am trying to Implement a Code that is Working in my previous page but not working in WordPress for some reason
- How to use $ with externally loaded javascript
- Override parent theme deregister
- Add JQuery As Code Snippet
- Theme customisation – how to store javascript externally when it utilises php variables?
- Getting click on item to open closest relevant element (popup) with jQuery
- Form validation before submitting
- How to make JQuery load on top of head tag before everything
- jQuery for Fade Preload Causes My Site Favicon to Disappear from Tab of Browser
- Show and hide element when URL contains certain section of text?
- Defer Parsing of Scripts
- Customizer add query to preview URL
- Orderby post__in Not Working Correctly?
- Get ajaxForm response value
- why does so many javascript libraries are loaded along with my website?
- Why does my media selection script write to ONLY the first input field?
- Update a parent theme JQuery property in the child theme
- Site images are fixed in front of my site content [closed]
- onclick jquery function not working in wordpress header file [duplicate]
- Notify user we would like them to clear their cookie. Provide a working button to clear cookies for user
- Modify the href attribute of tag dynamically in WordPress
- JQuery toggle in Visual Composer
- Add a jQuery snippet for sepcific user role
- Bootstrap with separate js File
- jQuery not working for media uploader
- Call full image url instead of stylsheet directory url in JS for Infinite Scroll Function
- Adding scripts before plugins scripts
- Move jQuery on *top* of footer
- How to toggle custom WP archive list
- comment-reply.js disables any other form javascript
- WP Media Uploader modal conflicts with Bootstrap modal
- JQuery and Javascript to pan image
- jQuery search function not running in WordPress but running locally (fiddle)
- Masonry – Can’t Find Variable imagesLoaded
- How to blur the_post_thumbnail() via blur.js (jquery)?
- JQuery Login Dropdown not functioning in theme
- Custom Javascript not working? [closed]
- How to get this jQuary script working?
- Youtube Iframe Api play one video at a time
- Javascript function to switch out images
- How to add JS snippet before closing tag?
- Enqueue javascript that inserts custom php widget into jQuery-constructed div
- Retrieve customizer value using ajax or customizer api and print the value in theme
- Displaying contents of a tab
- Disable drag metaboxes, create many functions using js not to work!
- How to deregister scripts all at once
- Uncaught TypeError: undefined is not a function (shortcode-box)
- How to block action if post is “dirty”?
- Clear custom field when new tag is added
- Are you sure popup on Contact Form 7 [closed]
- WordPress video end function [duplicate]
- Trying to get fittext to work in WordPress
- wp_register_script Question
- Add jQuery function to media button
- How to Run a jQuery Script after a Javascript Script has Finished in WordPress
- jQuery ajax empty exeption on wordpress
- TypeError: $ is not a function Error using parallax effect in WordPress Template [duplicate]
- Custom jQuery plugin not working
- Ensure an external javascript file called from plugin is loaded after jquery is called
- Why my vertical tab js code is refreshing the page continuously? [closed]
- javascript not loading in wordpress
- JS file not loading [closed]
- bootstrap-slider.js by seiyria not working in wordpress
- jQuery append only works if I select html in admin section [closed]
- jQuery functions work in console, but not live
- Javascript Loading Effect to URLs
- Carousel Hover Image
- Use WordPress Built In Jquery
- Individual Pages are loading halfway down
- Widget won’t work due to old JavaScript? Any ideas how to make it work? [closed]
- How to Javascript/jQuery
- shortcode execution when the page is opened
- Sending jQuery variable to php function