A brief explanation on custom post types and how to use them in WordPress.
Learning how to work with them can add extra functionality to your site without relying on paid or bloated plugins.
What is a POST TYPE?
We have to start here first. In the WordPress world, a “post type” refers to the different types of content. I do agree that it should been called “content type”, but do see how its official name makes more sense with WordPress’ origin as a blogging CMS.
Anyway, I’m sure you’ve already seen the default “post types”:
- POSTS – used for blogging, organized categorically and chronologically.
- PAGES – used for static content, sometimes organized with parent-child hierarchy.
- PRODUCTS – used for store products, organized categorically or name/price/etc.
I’m sure you’ve also seen the custom post types that come with different plugins:
- PORTFOLIO – shows videos/images or text.
- SLIDER – slideshows of images. Some allow text and flashy effects.
- REVIEWS – used for written testimonials or numerical rankings.
- RECIPES – listing descriptions, ingredients and instructions.
- REAL ESTATE – images, descriptions, pricing, and other important stats.
So basically, a CUSTOM POST TYPE is pretty much just a post type that didn’t come default with WordPress. And if you think about it…most of those WordPress plugins you’re installing are just adding their own custom post types.
When do you need a CUSTOM POST TYPE?
1. TAXONOMY
The most common reason for needing a custom post type is when you need to organize (and find) content in a different way.
Let’s suppose you wanted to make a site featuring fitness trainers for hire. And from the frontend of your site, you want users to be able to search for them or filter based on their skills or location. And on the backend, you want to be able to quickly manage all your trainers and edit their info as needed.
In this case, using the default POSTS or PAGES wouldn’t work because they aren’t organized in that manner. Posts are only organized by categories or date. Pages are only organized by parent or child. But the other issue is that even if you tried to shove this info anyway into POSTS or PAGES, it would confuse the site as your fitness trainer pages would show up along your blog posts or mix in your with existing company pages without any clear separation.
The backend would also be an issue as you wouldn’t be able to easily see all the trainers. Their content items would place them alongside your other content and take you forever to manage things.
In a moment like this…using a custom post type (CPT) would allow you create a new TAXONOMY and new way of classifying your new content. Instead of organizing by date or categories, you could instead organize them by geographical location and then allow “skill” tags. And this new taxonomy would allow for a new way of browsing through them on the frontend and backend.
2. DATA INPUT
Another common reason for CPT is when you need to enter different kinds of data.
Let’s start with the default WordPress post types….POSTS and PAGES. They have an area for the title, then another area for the content. Then in the document options, you can choose publish date, author, and featured image. That’s it.
This might be fine for a blogging site, but cumbersome for fitness trainers. Do you want to be typing the same stuff over and over? What if instead of typing their skills location, you could choose from a list of checkboxes.
Don’t forget: how we input the data affects how we search it as well. If you’re just typing info out as raw text, it probably can’t be found in any other way than to search it. But if you’re using dropdowns and checkboxes and what not, that would allow it to be organized differently on the backend which then allows different ways of browsing through it on the frontend.
What if it wasn’t only skills and location? What if you also wanted to put their hourly fee? Links to their personal website? Phone numbers. If they do only privates, or can also do groups. If they travel to you or only work out of their gym. Etc. To manually type all this out into a text box using POSTS or PAGES or is probably not very efficient.
Basically, CPT’s would not only allow you a different way of inputting and browsing data but also a more convenient layout to enter it. It not only saves tremendous time but also makes everything so much easier to understand when used by other people (customers, or staff).
3. CONTENT LAYOUT
CPT’s can (more conveniently) allow you to show your content in different ways.
Look at the typical POSTS and PAGES layout. They have the title first, then author and data right under, and then all the content right after that. And then at the bottom, posts may show comments.
Now look at the PRODUCTS post type. It usually has the product image on top left, then product name pricing and quick info on top right, then long description and detailed specs right underneath.
But what if you needed something else?
Suppose you wanted to show your trainer’s image at the top middle, then name right under it (and with their hourly fee highlighted in a different color), and then a description, and then a big checklist of the skills, then map of the geographical areas they cover, and finally a box with their contact info inside?
Woohoo! That’s a lot of customizations, isn’t it? And I bet you sure as heck don’t want to be copy-pasting all the style code in every personal trainer page that you make on your site.
Well with CPT’s, you won’t have to! All that styling can be put in one place and applied globally so you don’t have too mess with styling for each trainer you create. During data entry, all you should have to worry about is entering their data.
4. CONTENT RE-USE
CPT’s allow you to reuse your content however you like!
Let’s look at how other post types (or plugins) reuse their content throughout the site:
- POSTS – shows posts in chronological order on blog/category pages. Can show bulleted lists in widgets. Can also show random or related posts at end of other posts. Can also show comments in widgets.
- TESTIMONIALS – shown on home page using rotating carousel.
- PRODUCTS – shows on store and category pages by default, but also featured on home page. Shown on other product pages in the “Related Products” area.
Now let’s come up with ideas for your fitness trainer site…
- What if you wanted your site to feature different trainers randomly on the home page? (like those testimonial boxes)
- Or maybe you just a big grid of all your trainers images on the home page, and then their name and location only appears on mouseover?
- Or maybe you only want a map on your home page with little markers for each trainer?
- Or how about an image of a gym showing different workout machines, which when clicked on show the list of trainers who can train you on that machine?
- And then on a directory page, you have just a plain alphabetical list of all the available trainers on your site.
With CPT’s, you can have many more options of how your info is shown because of the way you inputted it.
How to use CUSTOM POST TYPES?
This is the part of my guide finally gets brief! Either you’re A) a developer or want to become one or B) really really tech-savvy.
First off, you’ll need a custom post types plugin. There are many out there and there’s confusion as to what does what. The two main functions they cover are either 1) creating and managing custom post types, and 2) creating and managing custom post fields. The confusing thing is that some plugins try to do both (and not very well). Think of custom post types as the page template, and custom post fields as the data items that go into the page template.
In most of my hard-coded setups, I have only Advanced Custom Fields (ACF) and that’s it. Everything else (like the custom post fields) is hardcoded and doesn’t need to be edited much anyway. I highly recommend Advanced Custom Fields because I’m most familiar with it. It’s an easy one to start with, very powerful, and a favorite among experienced developers.
But if you need both functions and/or learning how to mess with CPT’s and don’t have any coding ability, you will probably need Custom Post Type UI (a plugin that manages custom post types) and then also Advanced Custom Fields (which manages custom post fields).
I recommend these guides below:
- How to Create Custom Post Types in WordPress – by wpbeginner
- When Do You Need a Custom Post Type or Taxonomy in WordPress – by wpbeginner
- Advanced Custom Fields Vs. Pods Vs. Toolset: A Detailed Comparison – by Elementor
- Custom Post Types UI vs Types for WordPress Custom Post Types – by EngageWP
Now go play and see what incredible things you can do, all without relying on extra plugins!
Pol Ev
What is your opinion on Toolset? It seems popular yet have not found many reviews on it. It seems to try to achieve too many things so not sure if it might be too much bloat.
Johnny
I probably wouldn’t call a CPT tool “bloated”. Developers that work with these tools have extreme preferences to favor one/some over others. So you’d have to read between its users and non-users to get an idea why it is or isn’t used for projects. I use ACF/MB because they’re more popular in my dev circles (and probably in general IMO). I never had time to try a 3rd or even 4th option…which is where I’d place the rest of them like Toolset, Pods, etc.
Alex
What do you think about Carbon Fields plugin? This one is like ACF but without gui
Johnny
I’ve never tried it since ACF and Metabox does everything I want with custom fields. Your description of Carbon Field being like ACF but without GUI doesn’t exactly entice me either. Hahaha.