Course: Clarifying Technical Terms with Multiple Meanings in WordPress
This course works to straighten out the many meanings of several key technical terms.
In WordPress development, some words just keep cropping up. Words like “post,” “page,” and “template” show up everywhere on the technical side of WordPress—and each term can mean multiple radically different things depending on context.
In this course, we work to straighten out the many meanings of a number of key WordPress technical terms. If you read it carefully, you’ll be much more likely to understand what other people are talking about, and to be well-understood yourself. You’ll also learn quite a bit about the inner workings of WordPress, since that’s bound up intimately with these terms themselves.
Before we dive in, an invitation. If you want to better understand WordPress development in general, have a look at our full “learn WordPress development” course, Up and Running. It’s the best guide to WordPress development out there.
The Best Way to Learn WordPress DevelopmentUp and Running is our complete “learn WordPress development” course. Now in its updated and expanded Third Edition for 2018, it’s helped hundreds of happy buyers learn WordPress development the fast, smart, and thorough way.
Here’s what they have to say:
“I think anyone interested in learning WordPress development NEEDS this course. Watching the videos was like a bunch of lights being turned on.” -Jason, WordPress developer
“Other courses I’ve tried nearly always lack clear explanations for why WordPress does things a certain way, or how things work together. Up and Running does all of this, and everything is explained clearly and in easy-to-understand language.” -Caroline, WordPress freelancer
Now, let’s get started!
1. The Different Meanings of “Template” in WordPress
Key Point: Four Meanings of “Template”
“Template” generally means one of four things in a WordPress context:
1. Static HTML Templates
You can think of an HTML template as a WordPress theme, but with none of the PHP coding to give it functionality. And, indeed, some WordPress themes are based on existing HTML templates, which are then “hooked up” to WordPress’s PHP codebase to make them dynamic.
2. WordPress Themes
Some people, especially people coming from other CMSes or who are new to WordPress, use “WordPress template” to mean “WordPress theme.” They might ask, “What template should I buy for the site?” and what they’re asking for is a theme recommendation.
3. A WordPress Theme’s Page Templates
A WordPress theme’s page templates are a collection of PHP files that dictate the layout of each part of the site. For example,
front-page.php dictates the look of the site’s static front page, if it has one;
single.php dictates the look of an individual post of type Post (usually a blog post). Controlling which page template dictates what is the job of WordPress’s template hierarchy.
These page templates can be called just “templates” for short, and they are: each one is the template that dictates the appearance of a particular content type.
4. The Files of an Actual Templating Language
By default, WordPress’s page templates do not separate logic (PHP) and presentation (HTML). Keeping that separation is a general best practice in the programming world, and it’s the job of templating languages such as Twig or Handlebars.
These languages produce template files: files with HTML that dictates the appearance of a given webpage, plus template tags that indicate where programming logic should go while keeping the actual logic separate. Templating languages can be used in WordPress, and doing so has benefits for code readability and maintainability.
2. Understanding “Post” and “Page” in WordPress
Key Point: Meanings of “Post”
The phrase “post” in WordPress has two primary meanings, which are quite different from each other:
1. A Piece of WordPress Content, of Any Post Type
WordPress stores virtually all its content as posts, of different post types. A few examples of post types are: Pages; Media Attachments; custom post types you might register, such as Products, Recipes, or Portfolio Items; and—quite confusingly—Posts.
These different post types are similar in that they’re stored similarly in the “wp_posts” table of the WordPress database, and that you usually create and edit them using WordPress’s post editor. Otherwise, they can have quite different purposes and data attached to them.
2. A Piece of Content Whose Post Type is “Post”
The oldest and perhaps most common WordPress post type is called “Post.” It’s used primarily for blog posts, news items, and other pieces of date-sensitive content that are best displayed in a reverse-chronological scroll like on a blog.
Like any other post type, Posts are WordPress posts—in other words, they are pieces of WordPress content that are stored in
wp_posts. However, they alone are of post type Post.
Key Point: Meanings of “Page”
“Page” in WordPress has two quite different meanings:
A webpage is a URL on the internet, as rendered in your browser.
https://google.com is a webpage—the Google homepage—and this course, as accessed at this URL, is also a webpage. That just means it’s a specific location online that your browser renders into something you, the user, can read and interact with.
WordPress uses PHP to build post content—as well as other elements, like your site’s header and footer and its CSS stylesheets—into webpages that you can view in your browser.
2. A WordPress Post Whose Post Type is “Page”
“Page” is a WordPress post type that exists by default. Only some WordPress posts are of type Page. These are the posts under “Pages” in your WordPress dashboard.
Page-type posts are usually used for standalone pieces of content, like your About or Contact pages. Unlike Posts (which usually make up a site’s blog or news section), Pages usually aren’t time-sensitive or interrelated, and so viewing them in a reverse-chronological scroll, or by tag or category, is not possible by default.
3. What “Caching” Can Mean in WordPress
Key Point: General Definition of “Caching”
“Caching” itself means, in all cases, something like the following:
- Identify a particular resource—such as a particular calculation, a CSS stylesheet, or a full webpage— is likely to need to be accessed multiple times.
- Store that resource in a form, or in a location, that is more quickly accessible by people making the request. This often entails “freezing” dynamic operations into their static results, and serving only the results themselves.
Key Point: Six Kinds of Caching
The six kinds of caching that are relevant in WordPress include:
- Storage of static assets in the server’s temporary memory (RAM), rather than disk storage. RAM is much more quickly accessed than disk storage.
- Storage of static assets, such as images, on a server that is physically closer to your visitors, with a content delivery network (CDN). This improves performance by reducing the physical distance that the requests and responses to fetch those resources must travel.
- Full-page caching via a server utility, such as Varnish. This captures the full HTML output of a given URL, and simply serves that output when that URL is requested again—completely bypassing the PHP processing and numerous database queries that are required to “build” the site using WordPress’s codebase.
- Full-page caching with a plugin, such as WP Super Cache. This still captures and serves full HTML pages, but does so through PHP and a plugin that runs within WordPress’s regular processing flow. As such, it’s not as performant as server-based full-page caching.
- Partial caching of transients with a server utility like Memcached that creates an in-memory datastore. This takes particular pieces of temporary data—such as the list of Facebook followers fetched from a Facebook API call for a
social media widget—and stores them in the server’s memory for quick access.
- Partial caching of transients with the WordPress database. This is an option that doesn’t involve server configuration. Instead, it lets the values of temporary data (again, like a fetched list of Facebook followers) be stored directly in WordPress’s MySQL database, rather than recalculated on every page load.
If you’ve read this course, you should now be quite a bit clearer on “template,” “post,” “page,” and “caching,” as those terms are likely to come up in WordPress. Thanks for reading, and we’d be happy to field questions or comments in the discussion below!
Image credit: jwyg