Creating custom post types in WordPress is as simple as pasting a bit of code and adjusting its values. Here’s what to do.
WordPress comes with default post types for blog posts, pages, attachments, revisions, and so on. However, when you want to make more unique content that suits the specific needs of your business or personal site, you might find these default custom post types limiting.
You can overcome this limitation by creating your own custom post types to extend the functionality of WordPress. You can create pretty much any custom post type, ranging from custom events to products testimonials, staff profiles, and so on.
In this post, we'll show you a few methods to create custom post types in WordPress.
The two main ways to add custom post types in WordPress are either by using plugins or coding them yourself. Using a plugin is usually the preferred method if you're looking for a quick, easy-to-implement solution.
But extra plugins on your WordPress website can end up as bloatware, bogging your site's speed down. If you're comfortable with writing code, we recommend the manual method.
If you'd prefer to use a plugin, however, the process is straightforward. There are several plugins to choose from, most of which are easy to use, such as Custom Post Type Maker, Pods, and Custom Post Type UI.
We'll recommend Pods as it has over 100,000 installations and comes highly recommended by WordPress experts and users. While using a plugin is a viable method of creating custom WordPress post types, this article will focus more on how to do it manually.
You can create a custom post type simply by adding a bit of code to your theme's functions.php file.
Below is a detailed piece of code that adds more options to your custom post type. In the WordPress backend, head over to Appearance > Theme Editor > Theme Functions (functions.php).
The first thing you will need to do is choose a name for your new function. In this example, we'll create a custom post type to create dedicated profiles for the partners of a law firm or consulting business.
We'll call our new function cp_post_type_partners.
Copy the following code and paste it at the bottom of the file:
This code leverages the WordPress-specific PHP that allows you to register a custom post type without having to create it completely from scratch.
Update the file and refresh the page, and your dashboard should have a brand new menu item called Partners.
That's it! To view the archive of your new "partners" custom post type, simply navigate to yoursitename.com/partners/. If you can't view the results or the browser returns a 404 error page, simply return to your WordPress dashboard, navigate to settings > permalinks, and save the permalink settings again.
Custom post types allow you to enrich your WordPress website and can be used in a variety of ways. From highlighting the profiles of partners to creating testimonials, products, and so on, custom post types are useful and easy to create.
You can even use custom post types to create your own online business, such as a web directory. Before you get started, though, be sure you know how to set up a WordPress website.
Never set up a website before but want to try? Follow these steps to get your own website up and running in just a couple of hours!
David is a WordPress lover who is passionate about helping small businesses grow!
Join our newsletter for tech tips, reviews, free ebooks, and exclusive deals!