Use wp_enqueue_script
in your shortcode handler, in WordPress >= 3.3 it will be added to the page in the wp_footer
action. Pass any data you need from PHP to JavaScript via wp_localize_script
.
Related Posts:
- How to get a jQuery script to run on a page?
- How to properly add Bootstrap and JQuery Javascripts?
- Correct Method to run scripts with dependencies without enqueue?
- How to prevent wordpress from loading old versions of jquery in wp_head();?
- Move WordPress native javascript to bottom of page?
- Add custom shortcode button to Editor
- RequireJS in custom theme. Working Example
- Asynchronous Javascript Loaders
- wp_enqueuescript won’t load in footer even with true value set?
- How wp_enqueue_script works?
- WordPress Script Loading/Unloading — wp_deregister_script(‘jquery’)
- How do I get my page to load the jQuery UI Effects library?
- Script won’t execute in the media manager
- How to add unique image class to WordPress
- Enqueuing javascript files
- Creating multiple enclosing shortcodes and fixing JS issues on click
- Searching multiple tags and adding jQuery dependant script onto page template?
- Plugin Scripts no loading on options page
- How to enque js script in footer that are not in .js file?
- Loading scripts on a single page plants the script in the footer
- Nested Gallery Shortcode INTERMITTENTLY working
- Disable Cloudflare Rocket Loader for jQuery javascript and make it load first
- Using WP functions inside javascript
- Including Older Version of jQuery for IE7/IE8
- How To Include JavaScript Files Only In Single Posts?
- How to make JQuery load on top of head tag before everything
- JavaScript code do not works on online server
- Bootstrap with separate js File
- JQuery Login Dropdown not functioning in theme
- How to add JS snippet before closing tag?
- Enqueue javascript that inserts custom php widget into jQuery-constructed div
- How to deregister scripts all at once
- Uncaught TypeError: undefined is not a function (shortcode-box)
- How to Run a jQuery Script after a Javascript Script has Finished in WordPress
- javascript not loading in wordpress
- bootstrap-slider.js by seiyria not working in wordpress
- How register library to use jquery correct
- WordPress error when replacing local jQuery by externally-hosted
- WP Customizer compare and set a value via javascript
- Trouble enqueueing jquery with custom theme
- Why is JavaScript being added to header as application/oembed?
- Callback After WordPress Customizer Complete Loading
- Why should I deregister jquery?
- Deactivate JS Script in Plugin Shortcode
- “JQMIGRATE: Migrate is Installed” How do I find the problem code? [duplicate]
- Referrer URL with jQuery or Javascript – Cache & Referrer URL Issue
- Why doesn’t jQuery use $, and how can I get it do so (GLOBALLY)?
- Create special WordPress slideshow with “jquery.cycle.all.js”
- Using Foundation 5 in WordPress Administration Area
- I have an old version of jQuery showing up. How do I figure out where it is coming from?
- Close Fancybox, sumbit form data and redirect
- How do I include javascript/jquery image resizing with wordpress?
- Ajax Validation for reCaptcha
- include shortcode values in Thickbox form
- registering new jQuery after wp_deregister_script() not working
- Properly embed javascript into WP (using function.php) – doesn’t work?
- Search input area autogrow – how?
- Using jquery and javascript in WordPress
- Populating shortcode values dynamically in theme template
- Loading a newer version of jQuery within WordPress
- Run a jquery script on on a certain template page
- On click load iframe [closed]
- Run JS function when JQ enqueued
- jQuery will not work on page from snippet or file
- Get value of selected option in select field in a WordPress form
- How to keep HTML form field that is conditional hidden with javasript hidden after page reload?
- Accessing javascript in multiple files [closed]
- How to change the text of the “You are about to permanently delete these items…” alert message when deleting media from the media library?
- Unable to get my javascript to work on my website – what am I doing wrong?
- Using jquery with wordpress using wp_enqueue_scripts
- Javascript asset not enqueuing with the rest
- Issues loading Jquery on WordPress website
- Script not loading when depending on jQuery
- Required radio button does not validate in form, when clicked through Javascript/jQuery
- Can’t delete the default jQuery in the theme
- How to load jQuery in TOP of wp_footer?
- jQuery selectable() function won’t work in wordpress
- oEmbed Video in Modal
- jQuery plugin not loading
- Change shortcode value by jquery in WP Editor
- Custom AJAX form not working async
- Can’t execute jQuery before my script
- Multiple Media uploader output to input
- Include Jquery libraries in wordpress theme?
- Why does deregistering jQuery cause other scripts not to load?
- AJAX Success Function using JS substr() fails in WP 4.1 vs 4.0
- jQuery is not defined, working on local server but not online
- echo do_shortcode for Contact Form 7 from within dynamically loaded php file
- WP_ENQUEUE not working with Foundation 5
- How to add external remote JS source to Gravity Forms?
- Load CSS files in header of Bones theme?
- Blur.js with WordPress – Enqueued, but server not finding file
- Is it OK combined wp-include js, jquery, css? [closed]
- Parse wordpress blog data using json api and ajax
- JavaScript Libraries in WordPress
- Screen Options JavaScript Code
- Problem adding MP3 attachments to a jPlayer playlist
- Is there some jQuery conflict here?
- wordpress before or after javascript problem
- Setting Variable Path to Template Directory inside Script