As developers, it can be confusing to understand the intent and role of the mechanisms in WordPress to differentiate content. What are post types, taxonomies and terms, and custom fields? Why do they exist? When do you use the built-in ones? When do you build a custom one? We need a definitive guide that provides structure and best practices for differentiating content. We need a Developer’s Guide. In this first part of the series, we’ll discuss the why, what, and when of the WordPress post type from both a technical and practical perspectives.
This article is part of a series called: Developer’s Guide to Differentiating WordPress Content: Post Type, Taxonomy, and Custom Field. Subsequent articles are coming your way.
Let’s start by understanding the intent of a website from the site owner and reader’s point of view.
For the site owner, a website exists to draw readers in and convert them into staying and loyal fans. If the website is for a business, then it also serves to convert readers into paying customers. Site owners want the content to be shared in order to grow their readership and market segment.
For the reader, the website needs to present relevant, timely content that the reader wants to read. Content needs to easy to find without searching for it. Content should be published frequently to keep readers coming back. And it should provide opportunities for readers to find more content, related to what they want. In a nutshell, the website needs to present content in such a way that readers can find it and discover more.
Think about all of the things a website has to do:
- Draw readers in and convert them
- Grow the readership and market segment
- Keep readers coming back
- Help readers find the content they want to see
How do we do that? We need ways to provide more contextual information about our content, to classify and group each for organizational purposes, make content relatable, and provide the means to filter and find content.
WordPress has the mechanisms we need to meet the requirements:
- Post types – for macro grouping
- Taxonomies and their associated terms – for micro grouping and context
- Custom fields – for granular details
In this article, we’ll explore post types. In the next ones, we’ll cover custom fields and taxonomies.
Post Types – Macro Grouping Mechanism
At the top tier, we have post types. This classification defines the intent and purpose of the content. It’s our big picture macro-level for breaking up the content into logical groups.
Each of these “post types” has a specific purpose and reason to exist. That “reason” is what determines the content assigned to it. The post type then says posts, pages, attachments, revisions, custom CSS, changesets, and any custom ones are different from another. The content within each of these “post types” is different from the other ones.
If you follow that train of thought, what are posts and pages? Each needs to have a specific intent and reason to exist as a separate post type.
Syed does a great job of explaining the difference between posts vs. pages in his post on WPBeginners. He says that pages are static “one-off” types of content, whereas posts are timely and meant to be shared. Let’s go deeper.
Did you know that all post types are stored in same database table?
On the technical side, WordPress stores all of this content into one database table, i.e. the
wp_posts table. It doesn’t matter if it’s a post, page, attachment, revision, menu item, or the other post types, all of them are stored in the same database table. Then WordPress uses the “post type” to differentiate the experience and how to display it.
Want to see the database and hear me explain about it? Click here for the video.
Post – Post Type
Posts are the content in your blog. That’s it.
Think about the intent of a blog. Why do you write articles? What does it do for your business? It draws people into your site. It gives you a platform to share your main marketing and mission message. You do that incrementally through the helpful tidbits, insights, opinions, stories, and news articles that you write and publish.
Blogs are meant to frequently share information to keep readers coming back and inviting them to explore. Blogs capture the reader and seek to convert them. They invite engagement through the comments and sharing through social buttons.
If posts are the blog, then that means the purpose and intent of the “post” post type is to frequently share incremental, timely information that converts readers.
Page – Post Type
Pages are our static, informative, and currently relative content.
It’s where you tell and show your audience who you are, how to contact you, what policies are, and what your mission is. It’s your About, Contact, Team, Testimonial, and Policy pages.
Pages can be collections of content to serve as launching points to discover other content. Think about that. Front pages, series, libraries, and more can serve this purpose.
Pages can be marketing-centric where we gather information from our readers and help to guide them on their buyer’s journey.
Pages can be sales-centric with service details, pricing information, product features, and checkout pages. You can have a page with all your current deals and specials.
Pages are more static, meaning you do not publish or update them frequently. They are not inviting engagement through commenting or social sharing, in most cases. They stand on their own to inform and process requests and sales.
“In a nutshell, Know the Code explains everything much clearer than any other online tutorial sites. KTC explains the WHY part of programming while most other tutorial sites just tell me WHAT and HOW.”
Go Pro and grow your expertise and career.
“Custom” – Post Type
Out-of-box WordPress provides us with different pre-defined post types. Each one has a specific intent and role for its content. But not everything fits within these pre-defined groupings. There are times when you need to build a new grouping for your project.
The term “custom” means that it is not built into WordPress Core’s codebase. It means you are extending WordPress by adding a new post type, one that you define and configure.
A custom post type then seeks to provide a new macro grouping for content with a specific purpose and role that is not available already. This content does not fit within a post or page. It has a different intent than those we discussed above. It needs to be displayed, authored, and tracked differently.
There’s nothing magical about a custom post type. It’s easy to build one from scratch and integrate it into your website. However, you want to only do so when you have a group of content that has a different purpose. It’s not part of the blog. Nor is it a static type of page.
For example, you may have an e-commerce site that has products for sale. Those “products” are good candidates for a custom post type. Forums, courses, forms, portfolios, and more are good examples of content that does not fit within the structure of a blog or page.
Want to hear and watch me explain what a custom post type is? Click here for the video.
When – a Practical Example
Let me help you to relate the post types. We’ll use Know the Code.
The Posts are for insights and quick tips, such as this article you are reading now. The intent of the “post” post type on Know the Code is to provide you with an insight or quick tip and lead you to dive deeper into the Library.
The Pages are informative, such as the contact and policy pages. Other pages are collections and launching points to help you discover more content, such as: the Mastery Skills page, WordPress Fundamentals Library, PHP Library, and more.
We use several Custom Post Types here on Know the Code. These include the Docx, Labs (hands-on building projects), Glossary, Help Center, and the Quips (embedded silly quotes just to break up the content).
Take a look at this content. Do you see how it’s not the same as a post or page. Docx are documentation like Codex. Labs are the hands-on code building projects and courses.
For example, take a look at the Introduction to Registering Hooks Events Lab. See how this content serves a different purpose than a post. Also, notice how it’s presented differently. There are episodes, prerequisites, and a list of goals.
How to Build a “Custom” Post Type
Building a new custom post type is easy as it’s only a few lines of code. The Custom Post Type Basics lab will walk you through the basics of how to add a new one.
Wrap it Up
Do you better understand the intent and role of post types now? From a technical point of view, we have to think about their role based upon how we build, filter, and render content. For a business point of view, we think about how to maximize the impact of the website and make the content work for us. For a reader, they don’t care about these technical terms, but they do care about the experience.
What do you think? Does it make sense to you? Let me know in the comments below.