WordPress & Learning JavaScript “Deeply”
WordPress is in use by more than 60 million websites, making it the most popular site management system on the Internet. Part of the popularity is that it’s a free, open-source software with handy plugin features, templates, and a constant source of new features coming from its contributors. But traditionally it has run on PHP, which does have a bit more of a learning curve.
If you’ve followed or used WordPress, you probably notice more and more JavaScript showing up, continuing with the release of WordPress 4.4.1. Matt Mullenweg, the man behind WordPress, made it clear this past year that this is a trend that will continue for some time to come, so every WordPress developer and site admin is faced with the prospect of learning JavaScript “deeply” to get the most out of WordPress. Mullenweg stated that WordPress would become a JavaScript-driven interface, so more and more of the web will likely follow suit.
JavaScript first appeared as a programming language back in 1995 with Netscape Navigator, and was picked up Microsoft, who released it the following year with its own version, JScript. It quickly became one of the most popular programming languages in use on the Web. JavaScript provides functionality to make web pages interactive, but one of the main benefits is that it runs on the visitor’s computer, not the server, so it doesn’t require constant feedback from a website that degrades service. It can add tons of features, from producing a series of on-hover images to creating in-depth polls and quizzes.
JavaScript is easy to use, in principle, because it mainly involves pasting a script block into existing web code. Some professional programmers disdained it in favor of other languages – like PHP or Perl – but after the release of Ajax, and the continuing explosion of new web sites, JavaScript got more attention from the programming community. This led to the creation of extensive frameworks and libraries, as well as server-side components, which brought JavaScript much closer to being a fully developed object-oriented language like Java or C++.
Gains in the performance and prevalence of JavaScript mean that newer operating systems and browsers, such as Windows 8 and IE 10, were optimized to take advantage of it. On the other hand, as its power and flexibility increase, more demand is placed on the JavaScript engine. Performance is always an issue to keep in mind.
If you’re like me, your first forays into JavaScript involved borrowing and adapting code that you could simply drop into your pages with minimal work to introduce some clever tricks for your visitors. JavaScript was a language for browsers. It’s quite a bit more than that, but it still works seamlessly alongside such tried-and-true web code as HTML and CSS. For somebody who has some basic knowledge of how to put together a web page, as well as the fundamentals of programming, JavaScript isn’t hard to learn or to use at any level of development you need.
You’ve probably heard, or will hear as you progress, about libraries like jQuery, or frameworks such as Dojo or Mootools. You can view these as a set of utilities which you may or may not need. If you take the time to learn them, they could save you a lot of work, but the end result won’t be quite the JavaScript code you’ll come to know and love.
To begin learning JavaScript, your WordPress site is already a source of code you can learn from. Open a WordPress folder in your host’s control panel, and in the /wp-admin/ folder or the /wp-includes/ folder you’ll find the /js/ folder. You’ll see JavaScript code already plays a part in your themes.php file, which determines the look and feel of your WordPress site. (If you have a sudden urge to start playing with it, be sure to save a copy of the original code!)
Most web programmers agree that one of the worst ways to being programming is the above-mentioned bad habit of simply copying and pasting random bits of code and making them work. Maybe that’s all you want, but real development, and real results in WordPress, mean learning a more comprehensive view of how JavaScript works and what it can potentially do. Another bad approach is those plodding online tutorials that aren’t much better. You learn all the basics, but very little in the way of putting them together. Try to do anything more ambitious and you’ll find yourself stuck pretty quickly.
In getting the most out of any programming language, its important that you be able to write your own code, from your own head, rather than rely on a patchwork from somebody else’s bag of tricks. By all means, start with the basics, but know that you’ll have to move on to something more involved before you can think of yourself as a programmer. Google worked hard on their search engine, so use it often. Check out the many tutorials on YouTube. Register for podcasts and webinars. Look at reviews and forums to find the best tutorials out there. Use the same due diligence when it comes time to pick up a framework to explore. Look for open source code that you can download, study, and play with. When you’re ready, find a good book, one that goes into detail, but detail you feel you’re ready for. A book that will train you how to build real-world applications from scratch.
It may take a small monetary investment, but a big investment in valuable time. But as a site administrator or developer who expects to be using WordPress in the future (and you will), you’ll get a lot of satisfaction – and traffic – by having the skills to do things with your site that nobody else is doing.