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.

How to Create Custom Post Types Using Plugins

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.

Creating Custom Post Types 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:

        /*Custom Post type start*/

function cp_post_type_partners() {

$supports = array(

'title', // post title

'editor', // post content

'author', // post author

'thumbnail', // featured images

'excerpt', // post excerpt

'custom-fields', // custom fields

'comments', // post comments

'revisions', // post revisions

'post-formats', // post formats

);



$labels = array(

'name' => _x('partners', 'plural'),

'singular_name' => _x('partner', 'singular'),

'menu_name' => _x('partners', 'admin menu'),

'name_admin_bar' => _x('partners', 'admin bar'),

'add_new' => _x('Add New', 'add new'),

'add_new_item' => __('Add New partner'),

'new_item' => __('New partner'),

'edit_item' => __('Edit partner'),

'view_item' => __('View partner'),

'all_items' => __('All partners'),

'search_items' => __('Search partners'),

'not_found' => __('No partner found.'),

);



$args = array(

'supports' => $supports,

'labels' => $labels,

'public' => true,

'query_var' => true,

'rewrite' => array('slug' => 'partners'),

'has_archive' => true,

'hierarchical' => false,

);

register_post_type('partner', $args);

}

add_action('init', 'cp_post_type_partners');

/*Custom Post type end*/

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.

Create Custom Post Types With Ease

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.