WordPress has the power to hold various types of content. An example of a single content is known as ‘Post’, although you should know that post is nothing but a specific post type present by default in WordPress just like ‘Page’ which is another kind of post type. In general post types provides same interface you get in posts and pages but they can be customized with different fields and use them for different purposes. For Example: ‘Media’ is also a post type but it has completely different features. Internally in database, all post types are stored at the same place i.e. in wp_posts table and they are differentiated by a column called post_type.
By default WordPres provides you five post types which are readily available to WordPress users or internally used by the WordPress system, the default post types are:
- Post (Post Type: ‘post’)
- Page (Post Type: ‘page’)
- Revision (Post Type: ‘revision’)
- Attachment (Post Type: ‘attachment’)
- Navigation menu (Post Type: ‘nav_menu_item’)
What is a Custom Post Type?
Any new post type registered (excluding the above five default post types) in WordPress either by adding hack in function.php or by using a plugin would be called as custom post type.
Any new custom post type will use its new URL slug which is defined by the user at the time of registering the post type.
A custom post type will also use its own slug within the site URL structure. For example: If you generate a new post type with URL slug as ‘blog’ then all content you post on that post type would be available on yourdomain.com/blog. Whereas individual content items would be looking something like this yourdomain.com/blog/content-slug. Another good thing about custom post types is that you can use custom templates in them. A custom template is for a single display of posts belonging to certain post type. You can learn more about the post types and custom templates here.
How To Generate A New Custom Post Types?
The easiest and reliable way of registering new post type is Types – Custom Fields and Custom Post Types Management plugin. Upon activation the plugin adds a new admin menu with title ‘Types’.
Navigate to Dashboard -> Types -> Custom Types and Taxonomies page and click ‘Add Custom Post Type‘ button. There are tons of options you can select from but the most important sections are: First, Name & Description which contains fields for Custom post type name in plural (For example: Articles), Custom post type name singular (For Example: Article), Slug (For Example: articles).
Another important section is Select Taxonomies where you can assign Tags, Categories or any custom taxonomy (can be generated with this plugin only) to the new post type.
When you are done with the options, click ‘Save Custom Post Type‘ button and your new post type will come visible on left admin sidebar just like posts and pages.
Registered post types can easily be edited anytime from Dashboard -> Types -> Custom Post Types and Taxonomies admin page. From same page you can generate new post types and custom taxonomies.
How To Generate A Custom Taxonomy?
After registering new post types, you might want to use a new taxonomy for grouping similar content together. Categories and tags are default taxonomies but you can create more taxonomies as well.
Types – Custom Fields and Custom Post Types Management is already active on your website so visit Dashboard -> Types -> Custom Post Types and Taxonomies admin page and click ‘Add New Taxonomy‘ button. Here also you will be seeing many options, the most important sections are Name and Description which is exactly same to post types name and description fields.
Second important section is ‘Select Post Types‘ where you can select the registered post types which will be using this new taxonomy.
And last important thing is to select whether you will be using the new taxonomy as hierarchical – like post categories, with parent / children relationship and checkboxes to select taxonomy OR flat – like post tags, with a text input to enter terms. Finally, when you are done with the options, click ‘Save Taxonomy‘ button and it will be added to the post types selected by you.