Tag Archive for 'k2'

How To Load the Latest Version of jQuery in WordPress

While WordPress ships with jQuery, it’s often a few updates behind the latest version. Since jQuery 1.4 is just out, I wanted to use it with K2. That in and of itself is fairly easy, and a simply matter of deregistering the ‘jquery’ script and registering a new one. While looking for a proper solution I came across this rather crude way of going about it quite a lot, and it’s a horribly way of going about this, and will (and has probably) undoubtedly result in old plugins and themes blindly overwriting newer version of jQuery with their own, once new hotness, now old and busted version of jQuery.

Ugh.

This PHP code snippet checks to see if the passed version is later than the one currently registered, and makes sure we’re not in the admin (just to be sure).

If our version is indeed newer than the one currently registered, we go ahead and grab the idol… eh, swap jQuery’s.

/**
 * Register a later version of jQuery if it’s later than the one currently in WordPress
 *
 * @param {String} our_version The version of jQuery we want to upgrade to if needed.
 */
function upgrade_jquery( our_version ) {
	// We want to use the latest version of jQuery, but it may break something in
	// the admin, so we only load it on the actual site.
	global $wp_scripts;

	if ( ( version_compare(our_version, $wp_scripts -> registered[jquery] -> ver) == 1 ) && !is_admin() ) :
	 	wp_deregister_script(‘jquery’); 

	 	wp_register_script(‘jquery’,
			get_bloginfo(‘template_directory’) . ‘/js/jquery.js’,
			false, our_version);
	endif;
}

add_action( ‘wp_head’, upgrade_jquery( ’1.4.1’ ) );

It sure would be neat if this was built straight into WordPress’ wp_register_script.

A Word About Wordy

I’m lucky enough to have force-fed myself enough roleplaying games and science fiction comics to have picked up English to a level where I’m often more fluent in it, than I am in my mothertongue. And for the purposes of of blogging about those two particular subjects, whatever grammar, puntuation and structure snafus that happen to find their way onto this blog are less a real worry than they merely distracting (and at times embarrassing).

But if one were to take writing more seriously, be it for personal, academic or straight-up professional reasons, a friend of a friend of mine recently started a site that’ll do just that, hassle-free.

I don’t generally plug things on this site unless I truly like them. And until I tried Wordy, I honestly didn’t know what use I could have for it. But listen, Wordy gets it.

It’s on-demand copy-editing, and it’s ultra slick. No hassles, no clutter, no crap. I took it for a test-run on a chapter from a book another friend of mine is writing, and the experience couldn’t have been better. If for nothing else, you should check it out just to marvel at the elegance of how they’ve set up the site and how clear their process and goal is.

Particularly interesting to some of us, is that they’re working specifically on a WordPress plugin, which should make it even easier to use. They’ve also got a blog (in Danish).

Now if you’ll excuse me, I’ve got some K2 code to clean up.

Where Were We?

Even though I intended to blog some more over the holidays, I instead spent most of the time glued to the computer working in various capacities on K2.

I feel I squandered the trust of the community, by having been too casual about K2 in the past. K2 has been first with a whole bunch of features and functionality, we had a rather large and very active community and a solid codebase, yet mostly due to me having other priorities it’s atrophied somewhat.

The good news is that we put out our 1.0 and subsequently our 1.0.2 over the holidays.

And the great news is we’re already up to having nine languages1 in our new localization repository which puts us well on our way towards the 1.1 release which is of course geared towards localization. We’ve got some pretty cool ideas in the pipeline for the roadmap after that, but more on that later.

Meanwhile, it’s been a while since I did any web design of significance, and I think I’d forgotten a little bit how fun it is (as long as Internet Explorer isn’t invited to the party that is). This has also meant getting reacquainted with the tools of the trade, old and new, and where I used to use TextMate for pretty much everything, I tried switching to Coda (I had a license, even though I’d hardly ever used it), and I’m now a full convert. Those Panic guys know a thing or two about software.

Cinch is another little app that’s been making my life a lot easier, especially since Chrome for OS X still doesn’t have the same functionality that the Windows version has had for a year or more, and since Apple refuses to acknowledge the need for a maximize button.

Now if only I could find a great app for resizing windows in a sane manner.

  1. Danish, german, spanish, latvian, norwegian, dutch, polish, swedish and turkish, with a russian translation on the way. We’re still looking for more, so if you’re interested, read this and give me a shout. []

K2 goes 1.0

It took long enough, but K2 just went 1.0. Oh what a feeling. Now to get the localization effort in a row and ready for 1.1.

Moving in on K2 1.0

K2 has been a fun project for a number of reasons, but most of all I’ve been happily surprised at how the entirely lax and cell-like development process has worked out. I recently picked up the reins again and started going through our bugs, weeding out where I could and organizing what was left, in an effort to get to a 1.0 release as soon as possible. So now’s the time to tell us if something’s broken or missing.

Read more over at the K2 site.

Aaaand We’re Back. Again.

I’m sorry for this past week’s permission-problem-outage, but despite having vacation, it’s been everything but quiet around here. And before we get on to other business, let me just take one more opportunity to congratulate Rasmus and Anna-Vera on their wedding this weekend, it was fantastic!

R+AV

Continue reading ‘Aaaand We’re Back. Again.’