A Primer on Building Your WordPress Website with Best Practices
If you’re a sci-fi fan or a fan of 80’s movies in general, then you know that 2015 is a special year: We’re supposed to have hover boards this year! And hover cars! And self-tying shoes! — That is, if you believe all the predictions of the classic 1989 film Back to the Future II (BTTFII). Well, if you were looking forward to those things, maybe this year is more of a downer.
Nevertheless, one aspect of the BTTF movies that I really like is how “Future Marty” is having to go through all kinds of crazy stuff to help “Past Marty” stay alive so that “Future Marty” can exist at all. Man, if “Past Marty” just understood what was at stake, he could have saved “Future Marty” a ton of trouble!
This reminds me of a mantra I tell myself whenever I’m building out a new WordPress site: “Don’t make life hard for Future You.” If “Today You” can do things to make “Future You” happier, then ALL of you is going to be better off. Another way this is often expressed in web development is “best practices”.
Best practices are both a method and a philosophy for web development. They exist when building custom themes, custom plugins, or just administering a new WordPress website.
This series focuses on best practices as pertaining to building out a new WordPress site. We’ll be digging into three main areas of best practices:
- Why and How to Use or Create Themes;
- Why and How to Optimize Images for Performance; and
- Why and How to Optimize your Posts/Pages for Search Engines.
While there are many other elements of building out a site that require best practices, these three categories relate to virtually every site that you might build out and allow for a good discussion of how best practices can make “Future You” very happy.
Intro to Best Practices
Before we jump into those subjects, it’s important to understand what best practices are exactly. Let’s tackle the philosophy angle first.
When I say that best practices are a philosophy, I don’t mean a literal philosophy that is clearly defined, like existential philosophy or something similar. Instead, it’s a philosophy, often subtle or unstated, that guides everything a particular organization or developer does in development. Many agencies or developers have ingrained ideologies or principles that guide how they build their sites, plugins, and themes, though they never necessarily wrote those ideals down.
One of the best and most detailed best practices statements of development comes from the WordPress Core Handbook. By reading through it briefly, you’ll notice that it is not focused on how to code or how to troubleshoot server errors. Instead, it’s a simple list of ideals that all your coding should strive toward. For example, “Design for the Majority” is a principle that guides how WordPress is developed and should inform how plugin and theme authors develop.
As a WordPress developer, I continue to strive toward the philosophies set out in that document. I find that those philosophies keep me from making future headaches for “Future Me”. Why? Because they make me ask questions about my code that make the code easier to work with in the future and prevent conflicts with future developments of WordPress. It doesn’t always work perfectly, though; and some philosophies are harder to implement than others. “Decisions not Options,” for example, is a challenging question to ask when you want your plugin to be as full featured as possible, but require the least amount of dials and buttons to get up and running.
Best practices are also a method because they inform how your code is done. A great example of this is the Engineering Best Practices document at 10up. The authors put a lot of attention into creating a guiding document that informs the standard by which they code their PHP, JS, which tools they use, how they do Version Control, and more. For anyone interested in improving their coding abilities, I highly recommend getting very familiar with that site.
What to Expect
You probably noticed that I still haven’t defined either the philosophy nor the methodology of best practices. That’s really not the purpose of this series. The purpose is to let the question of best practices seep into your development workflow. My personal mantra (which comes in several flavors) of “Am I making future headaches for “Future Me” with this code?” pushed me towards the philosophies of the WordPress Handbook and challenged me to format my code more like the 10up manual. That’s the point. Best practices begin by being reflective of your development practices and intentional about asking questions about what your “Today You” is creating for “Future You”.
With all that in mind, the next series of articles will ask questions about making your theme as future proof as possible, challenging you to get the most out of every image you upload to your site, and questioning whether you are getting the most social and search engine relevance of each and every post and page.