WordPress Post Type Generator

GigaBook Web Developer Tools

Posts have another difference to pages as they can be assigned to a taxonomy, so you can assign categories or tags to posts whereas you can't do this for pages.

Pages are not date specific and should be used for more static content types such as terms & conditions, archives, contact form and sitemaps. In WordPress pages can also easily have a different style/layout to the other pages by changing the page template.

As of WordPress version 3.0, WordPress has allowed you to create your own custom post types into anything that you want by using the register_post_type() function.

function basic_book_post_type()
$args = array(
'public' => true,
'label' => 'Books'

register_post_type( 'book', $args );
add_action( 'init', 'basic_book_post_type' );

When creating you custom post type you have a lot of options to choose from to get the post type exactly how you want it. You first have to decide if you want the post type behaviour similar to posts or similar to pages.

As the amount of options you can choose from can be quite complicated to go through all the settings and get them right so Coveloping have created a post type generator where you can work your way through all the settings and generate all the code you need to create the post type.

The WordPress post type generator will allow you to easily create the code you need to add new post types to your WordPress site.

There are a lot of settings which are linked to creating a new post type so the generator has separated the settings into the following sections:

  • Post type
  • Settings
  • Display settings
  • Labels
  • Permalinks
  • Supports
  • Capabilities

Post type

This settings area allows you to pick the name and description of the post type. You can also things like if the post type is hierarchical allowing you place parent pages to the new post type.

If you want to be able to display archive pages then you can define this from the post type first section. In WordPress you can export the data from the built in exporter tool but not all content can be accessed if you want this tool to be exportable then you need to define this in this section.


The settings area will allow you to change settings for things like the menu position and the menu icon in the WordPress admin area. You are also able to define a function to use for the meta boxes on the post edit screen allow you to add custom meta data to your new post type.

Display settings

The display settings will let you customise how visible your post type is for example if you want to hide this from public pages so that it's only available to users which are logged in.

You can choose if you want to exclude the post type from search results.

This section will also show you settings on how the post type is shown in the admin area for things like the navigation menus and the admin menu.


The section section allows you to customise the text whenever the post type is referenced for example when you're create a new post for this post type you can change what the labels at the top of the page will say.


If you want to change the URLs for the how the post types are displayed then you can do so in this section. For example if the post type was for a portfolio you can choose to prefix all the posts portfolio so that the URLs will look like this.



Allows you to customise what features the post type supports such as titles, author, thumbnails, custom fields, comments and page revision.


This will let you decide if the custom post type is going to be available from the new WordPress RESTful API.


If you want to customise the capabilities of users that have access to edit the posts of this new post type then you can use this section to change the capabilities of editing posts, reading posts, creating posts and publishing posts.

When you run through all the settings of the post type you can then click the generate code button to create your post type code.

<!--?php // Create new post type function create_new_post_type( ) { $labels = array( 'name' => _x( 'Portfolio', 'Post Type General Name', 'text_domain' ),<br ?--> 'singular_name' => _x( 'Portfolio', 'Post Type singular Name', 'text_domain' ),
'menu_name' => _x( 'Portfolio', 'Admin menu', 'text_domain' ),
'name_admin_bar' => _x( 'Portfolio', 'Add new on admin bar', 'text_domain' ),
'add_new' => _x( 'Add New Portfolio', 'Portfolio', 'text_domain' ),
'add_new_item' => __( 'Add New Portfolio', 'text_domain' ),
'edit_item' => __( 'Edit Portfolio', 'text_domain' ),
'new_item' => __( 'New Portfolio', 'text_domain' ),
'view_item' => __( 'View Portfolio', 'text_domain' ),
'search_items' => __( 'Search Portfolio Items', 'text_domain' ),
'not_found' => __( 'No Portfolio Items Found', 'text_domain' ),
'not_found_in_trash' => __( 'No Portfolio items found in trash', 'text_domain' ),
'parent_item_colon' => __( 'Parent Portfolio:', 'text_domain' ),
'all_items' => __( 'All Portfolios', 'text_domain' ),
'archives' => __( 'Portfolio Archives', 'text_domain' ),
'insert_into_item' => __( 'Insert into portfolio', 'text_domain' ),
'uploaded_to_this_item' => __( 'Uploaded to this portfolio', 'text_domain' ),
'featured_image' => __( 'Featured Image', 'text_domain' ),
'set_featured_image' => __( 'Set Featured Image', 'text_domain' ),
'remove_featured_image' => __( 'Remove Featured Image', 'text_domain' ),
'use_featured_image' => __( 'Use Featured Image', 'text_domain' ),
'filter_items_list' => __( 'Filter portfolio list', 'text_domain' ),
'items_list_navigation' => __( 'Portfolio list navigation', 'text_domain' ),
'items_list' => __( 'Portfolio list', 'text_domain' ),

$args = array(
'labels' => $labels,
'description' => 'Add new sites your portfolio',
'hierarchical' => true,
'has_archive' => true,
'can_export' => true,
'public' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_nav_menus' => true,
'show_in_menu' => true,
'show_in_admin_bar' => true,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes', 'post-formats' ),

register_post_type( 'portfolio', $args );
add_action( 'init', 'create_new_post_type');

Sign up now for your free trial

Join Coveloping membership from $4.99 a month and get your first month free, cancel at any time

Start Now

Need help with your website? Hire a coveloping freelancer - fill out our quick form with your requirements and we'll get back to you with an estimate and availabilty. Find out more...

Code Copied!