Easy-to-follow Tutorial on WordPress custom post type support
Easy-to-follow Tutorial on WordPress custom post type support

Easy-to-follow Tutorial on WordPress custom post type support


WordPress custom post type isn’t a new term to majority of programmers especially the ones that have built their sites using the WordPress platform. You may have even applied it for one or two tasks if you equally use the platform.

WordPress is basically about posts and pages. That’s a fact virtually everyone knows. But, running on the WordPress platform goes beyond those two to include things like categories, etc.

For you to properly understand what post types are all about, we will need to deliberate more broadly on the topic and include necessary examples. Of course, it’ll help your understanding of the concept and how to use it. If you are just starting off, it’s great! The lessons are very simple to follow especially for beginners.

What does WP Post Types Mean?

We will go on to define explain what custom post types are by quoting directly the explanation WordPress documentation gave.

The documentation says that the WordPress platform has the capacity to reserve and show a variety of contents. And each content item is what we know as “post.” Also “post” means “post type.”

Furthermore, we store each “post type” in a place called the “WordPress Posts” database unit. Meanwhile, “post type” is the column that separates them.

So what does this teach us? It teaches us that WordPress has the capacity to give an accommodate a variety of contents. Not just that it gives support to contents, it has the also capacity to merge the contents and group them under a single unit which we refer to as custom Post types.

Let’s consider this instance:

We can group posts by categories under post type while we group pages under the “page” post type category etc.

WordPress Default Post Types

Upon installing WordPress, we have default post types. To better grasp what custom post types are, we’ll have to consider these:

  • Post (Post Type: ‘post‘)
  • Pageisunder (Post Type: ‘page‘)
  • Attachment is under (Post Type: ‘attachment‘)
  • Revision (Post Type: ‘revision‘)
  • Navigation Menu (Post Type: ‘nav_menu_item‘)
  • Custom CSS (Post Type: ‘custom_css‘)
  • Changesets (Post Type:customize_changeset‘)

We haven’t exhausted the list. You can research on more.

As stated above in this tutorial, you can easily store a variety of contents on the WordPress platform. While post (post types) is grouped into one unit, the page (post types) is grouped in another different unit. But both are under the same category. The only noticeable difference between them is that while the first group’s Posts, the later group’s Pages.

You’re following, right? So, go on to the next segment of this lesson. We shall discuss custom post type support here.

What does Custom Post Type Support really mean?

We’re right into it. We shall consider the following here:

  1. The meaning of WP Custom Post Type?
  2. Why you should have it?
  3. Ways developers can get access to the tool
  4. Wrap up.

 WordPress custom post types: what do they mean?

Sure, you’d want to ask this question if you are just beginning on WordPress. You can create a variety of contents on the WordPress platform. You can go further to group each content item under a category (post types).

Importance of custom post types to developers

Still, don’t know the need of custom post types to you as a developer? Oh well, it’s pretty easy. Can you imagine a scenario when you wish to add a custom content type that WordPress didn’t come with by default?

Put differently. How about you need a new set of functionalities while using WordPress for your site building and you can’t find them in the default post-types? It’s a messy situation, right? So, how do you deal with it?

Sure, you already know it. You simply build a post-type by yourself. And how do you create such? It’s only through the WordPress custom post-type support.

To help you understand better how you can get this done, let’s consider these examples.

We can get it done in these two ways:

  • By using a plugin such as the widely known CPT UI plugin ) to build a WordPress custom post-types.


  • By coding directly in other to build WP custom post types of our choice.

What about Plugin?

Like said, the first method of creating this custom post-type is through the help of a plugin. The plugin that is reckoned to be reliable and widely used is CPT UI.

Sure, you can find some other plugins like Custom Post-Type maker and others.

Direct coding?

There are so many functionalities, codes or calls that WordPress has by default. We can use them to build custom post-types for our custom-made contents, functionalities or layout.

With this, we can group all custom content we create in one umbrella.

Take for instance you have a website for school with the use of the WordPress platform. The contents you will create will be specific to teachers, students and other elements that concern the school. You will need to arrange each of the contents in unique ways (in the WordPress post-types) which the WordPress doesn’t have by default. Let’s say for example that you are building a WordPress based website for a school.

That’s what we are talking about.

Here is what is interesting the most

Just with the use of different default tools of WordPress, we can build layouts, contents and lots more, each for a particular custom post type.

It is either you do the coding yourself to build the custom post type which is in the PHP file or you change the layout if it’s a big post type rather than just using the original version single.php and archives.php. This way, you save yourself the headache and time of building an entirely new system.

Please, note. You are not just going to build a customizable template to showcase your custom contents. No, actually, WordPress already uses archives.php and single.php to show content from its custom post types.

And also, if you wish to change the layouts to your unique taste, then, you need to build the complete file system for the particular custom post type. What this means is, for instance, for posts you’ll have: single.php and category.php with fallback to archives.php.

For us to show the custom post type design, we have to build their designs. We will name it this way: single-{post_type}.phpcategory-{post_type}.php etc.

Now, we will take more examples on this, and then wrap up the lesson

Examples of WordPress custom post-types:

function create_post_type() {
   register_post_type( 'cool_products',
         'labels' => array(
            'name' => __( 'Products' ),
            'singular_name' => __( 'Product' )
         'public' => true,
         'has_archive' => true,
add_action( 'init', 'create_post_type' );

Here is what this means:

It says we enter an instruction to enlist our custom post-type. And from the example given, it is obvious the last test you need to overcome in other to build a custom post type.

We progress from here to the next line of action which is to embed the function of the custom post type using: add_action().

And if this is done, then, hurray! You are done building the custom post type of our own which we can call cool_products. You can progress from here. You can go on to do templating, then to more argument and the rest.

Try this WordPress managed hosting if you are looking for it. Or use XAMP as a local server for install WordPress.

Wrap up

You will have found this tutorial very helpful. Not only that we covered some important points about WordPress post types and custom content. We equally discussed the processes involved in getting this system done.

However, this tutorial doesn’t exhaust all there is to learn about this topic. In fact, if anything, it should arouse your learning appetite and propel you to research further and learn more.

Spread the love
4 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 5 (4 votes, average: 4.75 out of 5)
You need to be a registered member to rate this.

Leave a Reply