You can do this with the function get_bloginfo()
. There is a special paramater called version
that retrieves the wordpress version from the $wp_version
variable set in wp-includes/version.php.
So you could do something like this
function register_jquery_wp_version() {
global $wp_version;
if ( $wp_version >= 3.8 ) {
// register and enqueue jquery A
}elseif( $wp_version >= 3.9 ) {
// register and enqueue jquery B
}
}
add_action( 'wp_enqueue_scripts', 'register_jquery_wp_version' );
Related Posts:
- Get only enqueued styles and scripts of the current theme
- Trigger a php file on every post or page if a condition is met
- Enqueue less file not working in child theme?
- Execute only on a certain page
- How to execute a simple php script in WP (I don’t think wp_enque_script applies here)
- Is it recommended to pass some data to scripts in `wp_enqueue_scripts`?
- if file_exists not working with wp_enqueue_style
- enqueue hover function
- Adding tawk.to code just before body tag on functions.php file
- How to enqueue CSS and JS only on specific template?
- Deregistering a script in WordPress seems impossible
- How to inject variables into public-facing JS using wp_enqueue_script
- How to only enqueue script if it’s a post
- WordPress Scripts Being Loaded in Footer
- Jquery function working in Dev Console but not otherwise [duplicate]
- jQuery code not working when included in functions.php
- Is the wp_enqueue method efficient?
- Correct way to enqueue page specific CSS file
- linking stylesheets and scripts with functions.php
- Double jQuery loaded
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- How to use wordpress function wp_enqueue_script() in php?
- Enqueing External JS on the remote server JS
- Trying to enqueue script – Nothing Happens
- url_to_postid returns 0
- ‘Bones’ theme: Load stock scripts in footer instead of header?
- Enqueueing a code block from an options framework
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- Using Google Analytics in an enqueued JS file
- Enqueue assets from multiple directories using add_action/do_action
- How to change order inside foreach using wp_enqueue_script?
- Call a single function on two different methods with hooks
- Enqueue sripts and styles only if function is called
- Load script and styles using an array of resources
- Importing the style and scripts in the plugin doesn’t work as well as in the theme
- When to use wp_register_script() function?
- How to stop loading my custom scripts files for wordpress iframe?
- How can I enqueue comment-reply script only on certain page?
- Chosen Select jquery Not Working in Plugin
- Adding javascript files to WordPress and jQuery version
- How can I print out a single stylesheet or javascript link?
- Adding Gravity Form With if(is_page) Is Not Working
- wp_enqueue_style conflict when using in different action hooks
- Errors while Loading Most Recent Version of jQuery
- Warning: filemtime(): stat failed for wp_
- How to enqueue structured data as file – jsonld file seems not to work
- Make a variable global and use it for inline script
- functions.php doesn’t load all custom theme assets
- start_lvl Ignored in Custom walker_nav_menu
- PHP Catchable fatal error: Object of class WP_Error could not be converted to string
- Load custom field value into div with AJAX
- Accessing a random image via ajax
- wp enqueue style and style sheet depth
- my function doesn’t return my post from today
- using add_action for a header hook that has an additional parameter
- Template part inside shortcode, unexpected reult
- get_the_terms – only top level
- how to retrieve uploaded url of zip files
- RecursiveDirectoryIterator not working in admin
- Call global variable array() in woocommerce child/template
- PHP WordPress optimization my loop code
- WordPress Sending data to Ajax with select option
- Get value from shortcode to do something
- SQL Injection blocked by firewall
- How to create global title in header of wordpress theme
- WP Cron job timeout issues
- Can’t find infinite loop cause
- Widget back end radio button issue
- Troll the hackers by redirecting them
- Putting php inside an echo php shortcode
- GET problem in WordPress
- Almost Done… Post Format Code
- if ( ! function_exists
- Exclude product attributes from taxonomy terms loop
- WP All Import / Update stock quantity from multiple XML files
- Split site title and apply different classes
- WordPress İmages Upload & Delete Error
- posts_nav_link pulling in multiple post types
- How to check a variable Changes
- Products listing check if meta checkbox is checked
- Check if user had autologin & if so, logout
- White screen after migrating site, but wp-admin works fine. Disabling all plugins, applying default theme and enabling debug mode does nothing
- How do I change the “login” label in My Account page to “Registered Customer”
- Edit a function to take different actions based on user role
- How to have different headers.php files based on the display page
- Customize the “Available for back order” text for specific variation
- How to create an Email Subscription input in WordPress?
- autocomplete in wordpress using ajax with json-data
- wp-login.php?redirect_to=https problem
- Fatal Error cannot log into wordpress and website disappeared
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Updating custom user meta
- WordPress: Create A Widget to Accompany Plugin
- SHARING TO FACEBOOK – FROM DYNAMICALLY GENERATED PAGE
- Adding placeholder text field to woocommerce checkout [closed]
- Cannot modify header information – headers already sent
- Millennial Media PHP Setup ( Code Integration )
- Insert into db with foreach problem
- Woocommerce – add tracking code to another email template
- How to add custom user role into wordpress