Backbone.js, Underscore.js and why they matter for WordPress

WordPress is transforming and you may not even know it. The project's largely been a PHP driven framework. According to Github, the code itself is around 85% PHP and 15% JS in WordPress 3.5. I can't find the reference right now, but Matt Mullenweg has commented before that based on the current pace of change, JavaScript will likely make up the majority of the code in the coming years. You may know that the new media manager in 3.5 is pretty much entirely JavaScript. The theme customizer is largely JavaScript too.

This means we're in for a transformative time as WordPress developers. And tools like Backbone and Underscore are partially what we have to thank for that. I'm not an expert at all. I'm not even a novice. But my understanding is that JavaScript is really stretching its legs with new-ish frameworks like these that allow programmers to do much more substantial stuff in codebases, especially in terms of communicating with the server.

And using these methods, vs purely PHP, allow for the application to do things faster and offer a nice, snappyΒ experience,Β  and probably loads of other benefits that perhaps Koop, Nacin, or someone smart could elaborate on. I just know I like using the new tools in WordPress built this way. I also know that there are a lot of outdated plugins that haven't updated from instantiating thickbox media modals to the new media modal. And that is in part because of the lack of developers' experience with the tools.

It's time for me to stop, because I'm already beyond my pay grade.Β But if I want to stay in the game in a few years, I imagine I'll need to change that.

So, the purpose of this post is to show you some resources for learning. Here's a sample plugin by Thomas Griffin (Soliloquy slider author) on integrating the new media managerΒ in a plugin. And here's another post by Mike Jolley (lead developer of WooCommerce) showing how to use the new media manager in a plugin.

More generically, check out this postΒ about these frameworks getting into WordPress core in 3.5. Also watch this video tutorial by Jeffrey Way on understanding Backbone and the server. And best of all peek into this Code School class on BackboneΒ if you're ready to get started on learning Backbone.

Similar Posts


  1. Man, what an awesome post! I’ve been looking lately to start learning how the new media uploaded works and was intrigued by how elegant it is (both for the end-user and the hacker). I must point to a plugin that made a great job integrating it, and I’m talking about “Attachments” by Jonathan Christopher. I recommend anyone interested in this subject to check it out as I learned quite a bit by reading its code.

Comments are closed.