How to Create a Custom Post Type
It’s simple to create Custom Post Types with Pods. This guide will walk you through the process. If you’re already confused, check out our guide to WordPress Custom Post Types.
1. Create Your Custom Post Type
Navigate to Pods Admin > Add New and click on the Create New button.
From the Content Type drop-down menu, ensure that Custom Post Type (like Posts or Pages) is selected.
Give your Custom Post Type a Plural Label. Let’s use the example of a book review website – the plural label is books.
Enter a Singular Label. In this example, the singular is book.
Clicking on the Advanced link provides you with some advanced options. In most situations the defaults will suffice. The options are:
- Identifier – this is the name that you will use when referring to your Custom Post Type in your code and shortcodes
- Storage Type – the options here are Meta Based or Table Based. Unless you have a specific need for Table Based storage, you should stick to the WordPress default, Meta Based. We’ve outlined the difference between Table and Meta based storage in our FAQ.
When you’re happy click Next Step.
The next step is to add some fields to your Custom Post Type. These fields are used to append data to your content. If you’re confused, check out our guide to WordPress Custom Fields.
To add a field, click on the Add Field button.
There are three tabs:
- Advanced Field Options
Let’s take a look at each of them.
This tab has the basic information that is required to create your field. Your options are:
- Label: the field label that will appear in your user interface
- Name: the name of the field that you will use in your code and shortcodes
- Description: a description of the field. This could be an instruction for the user or just a description. It is not required.
- Field type: this is where you determine the type of field. There are a number of options, including email, website, color picker, and even a Visual editor
- Options – Required: if a field is required the user cannot save the post until it is completed
- Options – Unique: a unique field must have a unique value inserted into it.
Below is an example of the form completed for a Number of Pages field for the Book Custom Post Type:
Additional Field Options
The additional field options tab gives you options that are contextual to the field type you have selected. Let’s take a look at some examples.
For the plain number field in the above example, options are provided for format, decimals, and maximum length.
The currency field has options for currency sign, currency placement, format, decimals, and maximum length.
The WYSIWYG Visual Editor field has options for different editors, output options, allowed HTML tags, and maximum length
Whatever field you choose, it’s worth checking out the additional field options to see how you can customize the field.
The Advanced tab gives you even more options that you may wish to use to control design and defaults and to control who sees the field.
- Additional CSS Classes – use to style your fields
- Default value – set a default value for your field
- Set Default Value via Parameter – if you wish to use a parameter to set your default value, set it here
- Show to Admins Only? to restrict the field visibility to your site admins
- Restrict access by Capability to select which capabilities have access to the field
When you’re happy with your field click Update Field.
This is how the Number of Pages example looks in the post editing screen:
Add as many fields as you need for your Custom Post Type.
Click the “Labels” tab to adjust the Custom Post Type labels across your admin. These are pre-populated with the name of your Custom Post Type. However, you can adjust them if you want to. Adding a new label to the first two fields will update all of your labels, or you can adjust each label individually.
Admin UI Options
The “Admin UI” tab gives you fine-tuning options for your Custom Post Type’s admin menu:
- Show or hide the Custom Post Type from the Admin UI, Dashboard, Nav Menus, and Admin Bar
- Set the name and position of the post type’s menu item
- Specify a custom menu icon using an image file or Dashicon.
Note: Specifying the location for a custom menu icon can be aided by the use of special magic tags.
The “Advanced Options” tab provides fine-tuning for how your Custom Post Type acts.
- Make your Custom Post Type public or private, exclude it from search, and determine whether it’s publicly queryable
- Choose which functionality the Post Type supports, like title, excerpt, and revisions
- Associate taxonomies with your Custom Post Type
The WordPress Codex for register_post_type has more information about the options available on the “Admin UI” and “Advanced Options” tabs.
Whenever you’re finished with your fields and your options click Save Pod.
Your Custom Post Type will be available in your menu: