Friday 1 March 2013

jQuery and WordPress: “A shift from PHP land to Javascript land


jQuery desktop photograph
WordPress is one of — arguably the – most popular content management systems in the world built on PHP. Many of the platform’s major features and enhancements since 2004 have been entirely written in PHP. Project lead Andrew Nacin, however, says that in the future much  more will be built in JavaScript.
“I think [WordPress 3.5] actually signifies a shift from PHP land to JavaScript land for pretty much everything we’re going to do in the future,” Nacin told WPCandy. “That’s been happening for a few releases now, if you look at most of the major features over the last three or four releases.” WordPress 3.5 brought the re-imagined media uploader, really taking the basic drag and drop uploading of version 3.3 to a new level. WordPress 3.4 introduced the theme customizer which allows users to make changes to any compatible WordPress theme in real-time.
“[These features] all very much JavaScript heavy because they have to be,” Nacin said.
WordPress image uploader made using Javascript
WordPress 3.5 “Elvin” bought a fully re-imagined uploader. It was the biggest JavaScript feature added since the theme customizer.

Two projects, similar ideals

Daryl Koopersmith, listed as a core developer on WordPress 3.4 and 3.5, was a major contributor to these new JavaScript heavy features. Nacin said that he and Koopersmith talk with the jQuery community a lot.
“I actually idle in all of their IRC channels, I’ve been to a few of their conferences, and I’m friends with most of their core team members,” he told WPCandy. “The nice part is that the partnership between WordPress and jQuery is really strong, and there’s not going to be a time when we kind of lose focus with what they’re doing.”
The two open source projects, Nacin said, have very similar philosophies to one another — both projects commit to backward compatibility, for one. Nacin has no qualms saying WordPress is always going to ship with the latest version of jQuery.
jQuery 1.0 blog post
jQuery isn’t quite as old as WordPress — it was released in 2006 — but both projects have been popular tools on the internet for a long time.

Special considerations

“So if they try and override jQuery just drop the hammer on them…”
Of course, relying on JavaScript even more isn’t without its own issues. Relying on it for these features only puts a spotlight on certain frustrations.
One common issue is when developers disable the included version of jQuery and load their own. Nacin sees these issues as a priority in future releases of WordPress.
“I think one thing I finally want to do in 3.6 is just prevent plugins from overriding pretty much any core script in the admin,” Nacin said. “So if they try and override jQuery just drop the hammer on them and just literally prevent it through code. Because that breaks so much crap and I’m literally done with it.”
One thing is certain: if you’re looking for an area of WordPress core code contribution to dive into and be involved in important features in future releases, JavaScript development seems to be at the forefront – with all the benefits and new challenges that come with it.

Share this

0 Comment to "jQuery and WordPress: “A shift from PHP land to Javascript land"

Post a Comment