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
- in_footer: gives syntax error
- Custom gutenberg block refuses to load viewScript and I don’t know why
- WordPress generating Undefined Variable warning
- Blob file download problem
- How to make container class in PHP
- Using and saving custom dropdown boxes on user profiles
- Copy taxonomy terms from one post to another programmatically
- Error using WordPress $wpdb object to get result from custom table
- How to loop through all the attached images in a post, and get their url one by one
- How to array only one key from another array
- Sidebar not appearing in footer, but it appears everywhere else!
- How to create table in wordpress without plugin? [closed]
- Use Tags to initiate Search
- How can i show post_class() within output loop?
- Search form does not work in my website
- Show About and Contact Us page when they’re clicked in the top menu.
- How to remove ?p= from wordpress short links
- How to Disable WordPress Page Revisions?
- Display custom field on 404 page outside loop
- single.php with different look by category
- How i can get post data from database when i am getting post id from url in wordpress
- WordPress Block developer from exporting Database via PHP
- How to retrieve the data from the sever and displaying it in a page?
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- Hook called before text widget save
- Is There A Way To Make Theme Files Accept Shortcodes?
- WordPress Ajax Always returning 0
- Is there any way to get a drop down list of time zones?
- src script only works on home page?
- php within html within php
- Conditional statement for dates
- Filtering a function’ output for a new continued function
- get_total () returns 0 – woocommerce [closed]
- Why does this update_post_meta function not delete the custom field itself?
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- How does WordPress interpret the php code?
- get_template_part() not firing within a switch statement when template has new WP_Query
- add onchange to select in a wp form
- WordPress Customizer Default Image
- How to list commenters and days since last commented
- How to show/hide php table rows based on the content of custom fields
- How can I include shortcodes within PHP?
- How to execute html code inside php?
- PHP Warning: strip_tags() expects parameter 1 to be string?
- Run str_replace on title and save the output to a custom field
- Which function crops images in wordpress?
- Using a $GET parameter from a URL, to redirect to a URL (WordPress)
- How to determine from a different folder (outside wordpress) if a visitor is logged into WordPress
- WordPress function and string as variable?
- Delete taxonomy and delete all post related it
- Is a series of update_option calls safe, performance wise?
- plugin add action hook is not working :