How to Create and Display Custom Post Types in WordPress

Do you want to create custom post types in WordPress? Are you looking to transform your WordPress website from a blogging platform into a well-developed Content Management System?

Custom Post type mechanism is the perfect way to organize your website, especially if it focuses on more than one subject. You will have the power to divide your content based on the information that they contain.

In this article, we’ll show you how to create Custom Post types for your WordPress website.

What are Custom Post Types :

Before we jump to create yourn own Custom Post Type let us first understand what does it mean. According to WordPress Codex, “Custom Post Types” also known as “Custom Content Types” is the specific type of post types that can be added to your WordPress using a simple function called the register_post_type(). Custom Post types comes in handy when you want to break the content of your website into smaller category.

Following are the default post types that comes with wordpress :

  1. Posts
  2. Pages
  3. Attachments
  4. Revisions
  5. Navigation Menus
  6. Custom CSS
  7. Changesets

If you want you can create your own Custom Post Type. For example, If you run a Tech Media website, then you would probably want to create a mobile post type. This post type can have different custom fields and even its own custom category structure. Woocommerce, which is one of the most used wordpress plugin also uses custom post type. Similarly many other wordpress plugins uses Custom Post type to store data on your wordpress website.

When and why do you need custom post types:

The Custom Post type is used when you don’t want to display your content in posts or pages. Also, it will be easier for you to keep a track of it, if your website focuses on more than one broader topic. It is more efficient than assigning custom categories to the post.

Custom post types option lets you choose a more suitable section for your post right from the start. This should help you classify your content better and more seamlessly.

WordPress custom post type has its own menu in the WordPress admin area, which leads to a list of posts of that particular type.


There are 2 ways to create Custom Post types in wordpress;

  1. The Simplified Method (i.e with the use of a plugin)
  2. Manual Method

Method 1 :  The Simplified Method

This is the easiest way to create a Custom Post Type in a wordpress website. This method is recommended for beginners and those who do not have a sound technical knowledge. Various plugins such as Custom Post Type UI, WCK Custom Post Types and Custom Fields Creatoretc are available on the Internet.

In this article we are going to use the Custom Post UI Plugin.

The first step is to install and activate the Custom Post Type UI plugin. Upon activation, the plugin will add a new menu item in your WordPress admin menu called CPT UI.

Now from menu go to CPT UI » Add New to create a new custom post type

Now you need to enter the slug for your custom post type. A WordPress slug is a text which comes after your domain name as a part of your permalink that is leading to your content. A slug only contain letters and numbers.

Along with the slug, you also need to enter the singular and plural names for your custom post type, Clicking on the ‘Populate additional labels based on chosen labels’ is completely optional. It fills in the rest of the label fields down below.

Next, Scroll down to the ‘Additional Labels’ section where you can provide a description for your post type and change labels.

These labels are used to manage the content for a particular post type throughout the WordPress user interface.

Next, scroll down to the post type settings options. In this section, you will be able to select various attributes for your post type. Each option comes with a brief description explaining what it does.

Next, scroll down to the general setting option, In this setting you can select which editing features this post type would support. Simply check the options that you want to be included.

Now, click on the ‘Add Post Type’ button to save and create your custom post type.

This will successfully create your custom post type.

On successful creation, You can start adding content.

We will show you how to display your custom post type on your website later in this article.

MEHTOD 2: The Manual Method:

This method is recommended for those who on client side and do not want to use another plugin. Also, one major disadvantage of using a plugin to create a custom post type is, if you even by mistake deactivate your plugin, all your custom post types will disappear. All your data will still be available but the post types would be unregistered.

To manually create a custom post type, navigate to function.php file from your WordPress theme directory then add the following code to it.

/* Custom Post Type Start */
function create_posttype() {
register_post_type( 'postname',
// CPT Options
  'labels' => array(
   'name' => __( 'postname' ),
   'singular_name' => __( 'postname' )
  'public' => true,
  'has_archive' => false,
  'rewrite' => array('slug' => 'postname'),
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
/* Custom Post Type End */

After adding this code, update the functions.php file and refresh your dashboard. On refreshing, the News post-type will automatically appear in the Admin Area of your WordPress. To see how it will appear at the front-end of your WordPress dashboard, refer to the image below.

Now it’s time to assign attributes and functions to it. For this, you need to use init for the hook in add_action(). The register_post_type() function takes the arguments.

/*Custom Post type start*/
function cw_post_type_postname() {
$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('postname', 'plural'),
'singular_name' => _x('postname', 'singular'),
'menu_name' => _x('postname', 'admin menu'),
'name_admin_bar' => _x('postname', 'admin bar'),
'add_new' => _x('Add New', 'add new'),
'add_new_item' => __('Add New postname'),
'new_item' => __('New postname'),
'edit_item' => __('Edit postname'),
'view_item' => __('View postname'),
'all_items' => __('All postname'),
'search_items' => __('Search postname'),
'not_found' => __('No postname found.'),
$args = array(
'supports' => $supports,
'labels' => $labels,
'public' => true,
'query_var' => true,
'rewrite' => array('slug' => 'postname'),
'has_archive' => true,
'hierarchical' => false,
register_post_type('news', $args);
add_action('init', 'cw_post_type_postname');
/*Custom Post type end*/

Diaplaying Custom Post Types on the Webiste :

The simplest method to do this is with the help of the Menu. For this, go to Appearance » Menus. Add a Custom Link to your Menu. The Custom link contains the URL and the Link Text of your Custom Post Type.

Make sure to use SEO friendly permalinks. Following the example of SEO friendly permalink.

You can change the permalink structure from the setting of your wordpress dashboard.

Displaying Custom Post Types in Widgets:

This can be done with the help of the Ultimate Posts Widgets plugin. For this, first, you need to install and activate the plugin. After that, go to Appearance » Widgets and drag and drop the Ultimate Posts widget to a sidebar. This widget can be configured according to your needs by selecting the option you want for your custom post type.

Please drop your queries in the comment section.

Recent Articles

Standard Display Drivers for Windows 10 FAQ

Drivers act like a translator between the device they control, and the other programs in your system. Google Translate is not support in your...

Pictures Tutorial How to Reset USB Ports on Windows 10 8 7?

If you did not find it, close the window and update a different driver. Authentic and functional files are kept in a compressed cache...

How to properly update device drivers on Windows 10

Windows Update, Device Manager, and Auto-Update Assistants from device manufacturers. In most cases, these methods will keep your device drivers installed and updated properly....

Injustice: Gods Among Us APK OBB Download Install 1Click Obb Installer for Injustice: Gods Among Us

The traitor will need to be found before they can kill everyone else. You can download this game for your phone or tablet from...

Ohjelmien poistaminen Windowsista

Jos Lutriksesta ei ohjeita löydy tai jokin ohjelma ei suostu käynnistymään, kannattaa ensimmäisenä vilkaista Winen tietokannasta, onko sitä lainkaan mahdollista saada toimimaan. Bugiraportteja,...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here