Free E-Book: Mastering the Fundamentals of WordPress Themes
Themes: The Keys to the WordPress Kingdom
If you’re like a lot of WordPress users, you’re always hitting walls. You can manage your site: write content, upload photos, even add new contributors. What you can’t do is customize it. You wish you didn’t have to call up a developer to perform miracles like the following:
- Create page templates that respond gracefully to the type of content you’re serving.
- Vary a layout while maintaining the full functionality of the original.
- Serve excerpted or altered post data while leaving the posts intact.
It’s not as hard as you think! All the above require only one thing: a grasp of the basic workings of WordPress themes. And that’s where our new free e-book, Mastering the Fundamentals of WordPress Themes, comes in.
“WordPress Themes are Factories” (and Other Key Takeaways)
You can get the e-book at the bottom of this post. But we also thought you might like a bit of key knowledge from each chapter, as well as the most helpful key takeaway from the book as a whole. Each of these building blocks can hugely accelerate your power as a WordPress user—so if any of them is news, check out the e-book!
If you learn one thing…
…learn what a WordPress theme itself is: a factory for processing posts into webpages. Each of the key pieces of WordPress themes play into this metaphor:
- The raw material: Posts are the raw material of WordPress. They come form the company warehouse (the database), and the factory’s job is to process them into the finished product: a browser-viewable webpage.
- Assembly lines: A given factory—WordPress running inside a given theme—has many assembly lines. This collection of assembly lines, and the rules for choosing which line processes a bundle of posts, comprise the WordPress template hierarchy.
- The machinery: All assembly lines work on posts using the same modular machinery, called The Loop. This modular construction, always based around The Loop, makes sure that any assembly line (that is, any page template) can process any bundle of raw material (assortment of posts) without breaking—and that any page can always fall back to the “main” assembly line, index.php and its instance of The Loop.
- Outside contractors: Lots of possible functions are useful, but shouldn’t be cluttering up the factory floor. These outside contractors (which may live in plugins, functions.php, or elsewhere) insert themselves into the production process using hooks, all while maintaining outside the core functioning of the factory.
There you have it: What a WordPress theme is and does. Pretty cool, right?
The Four Languages You Must Know to Understand WordPress Themes
The Three Core Concepts of WordPress Themes
This is a really foundational chapter: It points out the most important pieces of the WordPress factory.
Demystifying “The Loop” in WordPress
The Loop is the method WordPress uses to display posts, of any post type—whether it’s “posts,” “pages,” or something custom like “portfolios.”
Understanding the WordPress Template Hierarchy
The template hierarchy makes WordPress themes easy to customize yet hard to break using The Loop and index.php as reliable fallbacks, and a very flexible and powerful system to determine which template generates a particular page.
Make Your Themes Better By Getting to Know get_template_part()
get_template_part() lets you abstract out commonly-used PHP snippets from your page templates, so you never have to repeat yourself.
WordPress Post Template Tags: What They Are, How You Use Them, and Why You Care
Post template tags allow you to easily access different elements of post data—and to either display it or modify it using the convenient the_elment() and get_the_element() idiom.
How to Link to Your WordPress Theme Resources
Most ways to link to off-page resources are failure-prone. get_stylesheet_directory_uri() is right for most occasions.
Four Things a WordPress Theme Shouldn’t Do
A WordPress theme should basically have no functionality—it should only find ways to display data, never create or store data. Otherwise users will lose their data when they switch themes—that’s Theme Creep.
Dealing with Theme Creep
If your site suffers from Theme Creep, you can send any Creep-y functionality out into one or many plugins that will persist after the theme is gone.
Always Use a Child Theme!
Making a “child theme”—a mini-theme that inherits and selectively overrides another, “parent” theme—is very easy, and will let you update the parent (getting new features and improved security) without losing your customizations.
If any of these sound interesting, get the e-book today!
More About the E-Book
Mastering the Fundamentals of WordPress Themes is an introduction to the core principles that make WordPress themes work. In 40 pages, you’ll learn the key concepts of WordPress themes, with simple code snippets that make each concept come alive.
We’ve carefully shaped each chapter to call out key facts and principles, and to build on concepts from previous chapters.
Early reviews have been great:
Hello Fred and David, I just wanted to thank you for the ebook. I read a lot of WordPress materials, and it really stands out. I really appreciate that you shared and explained WordPress under-the-hood concepts in a way that a non-programmer can understand. I find this very rare! –Patty
If you’d like a preview, Take a look inside!