WordPress.org

Ready to get started?Download WordPress

Forums

Post UI Tabs
Using the latest jQuery-UI CSS automatically (11 posts)

  1. webaware
    Member
    Posted 1 year ago #

    G'day, I don't know if this is something you're interested in doing in your plugin, but if you want to keep your jQuery UI theme CSS up to date with the version of jQuery UI distributed with WordPress, see this:

    Load a nice jQuery UI theme in WordPress

    The downside is that sometimes Google CDN is a bit slow adding the theme updates, but Microsoft CDN is typically pretty quick.

    cheers,
    Ross

    http://wordpress.org/extend/plugins/put/

  2. Mark / t31os
    Moderator
    Plugin Author

    Posted 12 months ago #

    The plugin already uses the google CDN for loading the jQuery UI themes and also uses the WordPress included jQuery UI and tabs scripts.

    Thanks for the suggestion all the same. :)

  3. webaware
    Member
    Posted 12 months ago #

    G'day Mark,

    That comment was going back some 6 months now, but at that stage at least your plugin wasn't checking which version of jQuery was being bundled with WordPress, and was thus getting mismatched versions. Maybe you've fixed that since then.

    e.g. WordPress 3.5.1 bundles jQuery UI 1.9.2 and I think your plugin was loading a 1.8 release last time I looked.

    (I don't actually use your plugin, back then I was sorting out a support question on one of my plugins where the user was putting a map in a tab using your plugin, so I'm not really in a position to check what it's doing now)

    cheers,
    Ross

  4. Mark / t31os
    Moderator
    Plugin Author

    Posted 12 months ago #

    The plugin does not load jQuery UI from an external library, it's always used whichever one comes with WordPress, the only reference i make to an external library(namingly the Google CDN) is for the jQuery UI themes, which are purely CSS files.

    If there's something i'm missing, please feel free to clarify further.

  5. webaware
    Member
    Posted 12 months ago #

    G'day Mark, I'm just saying that it's a good idea to load the matching version of the CSS for the version of jQuery UI bundled with WordPress, because there can be some differences that the scripts rely on. e.g.

    jQuery UI 1.9.2 => CSS 1.9.2

    I took a look at your SVN current version and it's loading a 1.10 version of the CSS. It probably works OK with jQuery UI 1.9.2, but might not with an earlier version (e.g. someone stuck back on WordPress 3.4.x loading an earlier version of jQuery UI). Best to match versions and avoid compatibility issues.

    cheers,
    Ross

  6. Mark / t31os
    Moderator
    Plugin Author

    Posted 12 months ago #

    Usually i'd agree but the themes receive very minor and infrequent changes, i believe(for the moment) it makes sense to stick with the most current version(the current UI theme CSS is the most likely to display as intended, because tweaks and fixes, like this one, are in place where they wouldn't be for older versions).

    Changelog for jQuery UI can be found here. If you have a look through each of the changelogs(had quick look myself) you'll see there is very rarely any significant changes to the CSS files(no changes at all to the actual styling between some versions).

    You still have a valid point though and it's certainly a consideration for me to load matching theme versions if there are backwards compatibility issues(comparing CSS across jQuery UI versions doesn't show any significant changes that i can see). Whether WordPress holds version data on included libraries remains to be seen, if there's no easy lookup for the version, i don't think i'm prepared to bog down the plugin by literally reading the jQuery UI script line by line just to check the current version(or anything to that degree).

    I'll go boot up the WAMP install and have a dig around to see if WordPress holds version data for included libraries.

    Thanks for the feedback.

  7. webaware
    Member
    Posted 12 months ago #

    G'day Mark,

    Take a read of this blog post, it tells you how to find the version number of the included jQuery UI script.

    cheers,
    Ross

  8. Mark / t31os
    Moderator
    Plugin Author

    Posted 12 months ago #

    That's pretty much the approach i've been testing .. :)

    public function get_wp_ui_version() {
    
    	global $wp_scripts;
    
    	if( !$wp_scripts instanceof WP_Scripts )
    		$wp_scripts = new WP_Scripts();
    
    	$jquery_ui_core = $wp_scripts->query( 'jquery-ui-core' );
    
    	if( !$jquery_ui_core instanceof _WP_Dependency )
    		return $this->ui_version;
    
    	if( !isset( $jquery_ui_core->ver ) )
    		return $this->ui_version;
    
    	return $jquery_ui_core->ver;
    }

    Use the plugin's hardcoded version as a fallback.

    EDIT:
    Created another virtual host and plonked WordPress 3.3 on there with the current version of Post UI Tabs and the styling seems to all be ok using 1.10.2 CSS(WP 3.3 uses jQuery UI 1.8.16).

    This actually does highlight an issue in my recent update, in that jQuery UI prior to 1.9 used different methods to select and get the current tab, i updated the jQuery but didn't think to provide backwards support to previous versions(going to work on a solution for that now).

    Thanks again for the feedback.

  9. webaware
    Member
    Posted 12 months ago #

    G'day Mark,

    Good stuff, and nice to hear that you're supporting the older WP versions. I have to admit that I'm not putting effort into that myself, but I realise that some people can't easily update from 3.3 yet due to other dependencies so I probably should support at least as far back as that. Food for thought.

    cheers,
    Ross

  10. Mark / t31os
    Moderator
    Plugin Author

    Posted 12 months ago #

    In this specific case the backwards support i believe i need to provide is simply for older versions of jQuery UI, namingly any version prior to 1.9 which saw some of the tab functions replaced, namingly the select function and the selected option.

    WordPress 3.2 uses jQuery UI 1.7.3
    WordPress 3.3 uses jQuery UI 1.8.16
    and strangely WordPress 3.1 uses jQuery UI 1.8.9! (baffled as to why)

    I love that jQuery document all their changes across versions so well though, was a piece of cake finding all the information i needed to work from.

  11. webaware
    Member
    Posted 12 months ago #

    Ha, that's weird (WP3.1). Yes, it's nice when there's actual documentation for what has changed, which I find refreshing with the jQuery and jQuery UI projects.

    cheers,
    Ross

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.