Underscore, Backbone, and some basic JavaScript

Themes are awesome. Themes are amazing. Themes should be built with presenting user content in mind.

What happens when you introduce dynamic content? Live content. I know you may be wondering what I mean by this.

A little history

When I first began working with WordPress I knew the basics thing you needed to know about JavaScript. You know, the good old:

document.write( 'Hello world!' );
alert( 'How I am doing?' );
prompt( 'Is this working?' );

Yeah. Super simple things that interact with the browser. Didn’t get too deep into what JavaScript was or how to use it until the last few months. It has always been a goal of mine to learn more things about web development and this year was no different. I grabbed a few JavaScript books and began my quick journey into a world of hurt and a few headaches.

Yes, I got a few headaches and a few nosebleeds because some of the content was far too much to grasp. Some of it I still don’t fully understand but it is slowly making some sense. A lot of what helped was my short lived stint in what will now be a dead language. ActionSript. Yeah. I began that journey because I loved the idea of animating a site with Flash. Sorry. I was young and didn’t really know much better. As I said, this was before I really dove into what JavaScript was capable of doing.

Fast forward a bit and I had begun reading the JavaScript bible seventh edition. Later on I picked up JavaScript in 24 Hours, and a few other code related books. The most recent one being Eloquent JavaScript, Second Edition. I still have some reading to do on that one. I will say though my collection of reading has grown since I first began:

https://www.instagram.com/p/_nOXalML2B

Core usage

Now, as I’ve stated many times on this site, I will always recommend using core first. There are times when you do have to use other tools but that is because you really do have to use the right tool for the right job. When WordPress first introduced two neat little JavaScript libraries I was ecstatic. Backbone and Underscore JS. Both are great little tools that I feel are a great way of creating a theme.

One of the reasons I liked it being integrated was because it can resemble an MVC style of setup. I know there are some people out there who argue against it. I say it resembles in that it uses models and views. It does make it easier for many others to pick up if you come from another content management system other than WordPress. Yes, they do exist.

Yes, my list of reading materials just keeps growing and growing and this does include core code.

What next?

The next step is using all that knowledge and applying it to a theme. Yes, there are sliders out there that use JavaScript but using Backbone and Underscore in a theme would make for a super dynamic experience. Yes, there are other JavaScript libraries that can potentially be used but I’ll stick to learning these first.

Published by

Jose

Born in El Salvador. Loves to read, write, draw, paint, build, test, typography, hike, photography, art, design, sewing, and many other things.