Custom post types let you add your own data types to WordPress sites. When you build sites with custom post types, you make both the content administration and the front-end design easier.
Out-of-the-box, WordPress comes with pages and posts. If you want to display other types, such as products, testimonials, projects and anything else, the best way is to setup custom post types. With custom post types, different types of content are organized under different menus. You can also control user-access for different types, allowing better management of your site.
You can add custom post types to the WordPress admin using the free Toolset Types plugin. If you are comfortable writing PHP, you will be able to build custom templates using Types PHP API. You can display custom post types without writing PHP using the full Toolset package. We offer refunds for up to 30 days for Toolset, so you can try it, risk free.
Go to Toolset -> Post Types and click Add New.
At the top, you should add your name, along with your slug and a description. The slug field is what identifies the custom type inside WordPress. It may only contain English letters, digits and underscores. The plural and singular names may contain any characters.
In our example, we’ll create a custom post type for properties.
- Plural name – Properties
- Singular name – Property
- Slug – property
- Description – Properties that we have available to rent
- Icon – An icon that matches your post type
Once you enter the name and slug, you are ready to get started. You can click on Save Post Type.
When you are happy with your settings click Save Post Type.
Your new custom post type will now be available on the WordPress admin menu.
Besides the basic setup (name, description, and slug), Types gives you access to advanced setup. Although not always required, advanced setup will let you fine-tune everything about your data types.
The Visibility option lets you determine whether your custom post type will appear in the WordPress Admin or not. As we want users, such as authors and editors, to be able to add a property to the website we will make it visible.
If you’re creating the custom post types programmatically (with code), you probably don’t want them appearing on the menu. However, most custom types you will be creating with Types should usually be editable.
You can also change the menu positioning and if you want to show the number of entries on “At a Glance” widget in the admin dashboard.
Taxonomies are used to categorize your post types. The most common WordPress taxonomies are categories and tags.
If you have created custom taxonomies for your custom post type you can attach them here. If you have not created taxonomy yet, learn more about creating custom taxonomy.
Labels are the pieces of text that are attached to different areas of the admin screen, for example, “Add New Property” or “No Property Found”.
While the defaults often suffice, it can be useful to be able to tweak these labels to further customize your admin screen.
Types lets you choose which of the default WordPress sections you would like to display on the Add New/Edit Property page. These are:
- Title – the title of the post type (selected by default)
- Editor – the input text area (selected by default)
- Comments – give author ability to turn comments on or off
- Trackbacks – give author ability to turn trackbacks and pingbacks on or off
- Revisions – enable revisions to be made of posts
- Author – add a dropdown menu for changing the post author
- Excerpt – add a customized excerpt
- Thumbnail – give the author the ability to upload a featured image
- Post fields – add the post fields input area
- Page attributes – add the page attribute to change the display order
- Post formats – add post formats, such as aside, link, video (post formats in WordPress Codex)
Advanced settings let you further tweak your custom post type. Normally the defaults should be fine but in case you want to fine-tune everything about your custom post types, here is what these options mean:
- Rewrite – rewrite post types permalinks. You can use the normal WordPress URL logic (which you will have set up on the Settings -> Permalinks page) or you can use a custom URL format. The default for this is “true” and it will use the slug you defined earlier.
- Allow permalinks to be prepended with front base – if you are prepending your permalinks with a phrase such as /blog/ selecting this will also prepend your new custom post type with this phrase e.g. /blog/property/.
- Feeds – choose whether to publish a feed for this post type. It will default to the has_archive setting (see below) but this gives you the ability to turn off feeds while keeping an archive page.
- Pages – is the custom post type a dynamic (post) or static (page) piece of content.
- has_archive – determine whether the post type has an archive page or not.
- show_in_menu – determine whether you want your post type to show in the admin menu or not.
- show_ui – generates the user interface for the post type. If you don’t want a UI you should uncheck this.
- publicly_queryable – determine whether post type queries can be performed from the front end.
- exclude_from_search – check this if you want to exclude your post type from search results.
- hierarchical – lets parents be specified.
- can_export – allow this post type to be exported.
- show_in_nav_menus – determine whether this post type is available for inclusion in navigation menus.
- query_var – allow or prevent queries.
- Permalink epmask – add an endpoint to your custom post type (permalink epmask in WordPress trac).
- show_in_rest – set whether or not to expose this post type in the REST API.
- Rest Base – if show_in_rest is enabled, this is the base slug that this post type will use when accessed using the REST API.
In Post Fields section of Custom Post Type edit screen, you can set which fields to display as columns in the custom posts screen.
If we select Price, then the price field of the property will be displayed in the custom posts screen.
Types plugin also lets you connect different custom post types using parent/child relationships. For example, if you’re creating custom types for artists and shows, you can make the “show” children of “artists”. To set up post relationships, go to the Toolset -> Relationships page and click the Add New button. A wizard will guide you through all the steps.
When you create parent/child relationships between custom post types, you’ll be able to:
- Choose the parent for children
- List all the children of a parent
- Bulk-edit child items from parent editor
You can find more information about this in our comprehensive guide about post relationships.
Custom post types let you separate different content types from ‘posts’ and ‘pages’. However, just creating custom post types is not enough. With Toolset, you can also add custom fields and taxonomy and give different custom types the details that they need.
Toolset plugins make it easy to display custom content on the site’s front-end. When you use Toolset to set up custom post types, you can display them on the front-end, without editing any PHP.
If you are using only the Types plugin, to display this custom content on the front-end, you will need to edit your theme’s PHP templates manually. You can learn more about this in the following series: