Wordpress Custom Post Template

Posted onby admin

WordPress custom page template allows users to integrate custom requirements such as right/left sidebar on a particular page, an additional call-to-action functionality, or maybe a unique header for a particular landing page. Let’s dive in further to see how WordPress custom page template display different type of content. Themeta – Template tag that automatically lists all Custom Fields of a post; getpostcustom and getpostmeta – Retrieves one or all metadata of a post. Getpostcustomvalues – Retrieves values for a custom post field. Template Tags – WordPress Theme Developers Handbook page on Template Tags.

Looking for a way to add custom posts and pages with diverse properties and augmented layout? Here, I have listed WordPress Custom Post Type Plugins that will help you do that and much more.

The content is an integral part of a website. There are various built-in types of content provided by WordPress. For a simple blog or website, these content types might as well fit your needs. However, often you may want to create a customised look for your website. You may want to define your own content types with features that are not available by default. If you plan to build a more complex website, you can use the power of custom post types. With custom types, you get the flexibility to create any type of content. In this article, you will learn the benefits of custom post types and how to create them. Here at our WordPress them generator and website builder software, i will also do a feature comparison of some of the popular WordPress Custom Post Type Plugins.

What is WordPress Custom Post Type Plugin?

WordPress stores and displays content as posts and categorises them based on post types. A page on a WordPress site is of post type “page” and a post on a blog is of type “post”. WordPress some post types that are native to WordPress. These predefined post types are:

  • Post
  • Page
  • Attachment
  • Revision
  • Navigation Menu
  • Custom CSS
  • Changesets

A custom post type is a custom defined piece of content. These are new post types that you define and create for the custom content. The new post type is registered to WordPress as a custom post type. A custom post is a regular post, but has a different post_type value in the WordPress database. Some custom post type examples are:

  • Media
  • People
  • Products
  • Events
  • Places
  • Online Store
  • Testimonials
  • Quotes
  • Error Log

Need for WordPress Custom Post Type Plugin

Custom post types allow content to be input and displayed in a custom manner that is specific to the content. You are no longer forced to use just the built-in post types provided by WordPress. A custom post type can denote and store any type of information. The user gets access to an endless number of possibilities.

So, when to create a custom post type? If you must display content which doesn’t seem to fit to be either a Post or a Page. Or, you might need to add options to a post like names, titles, photos, email addresses, phone numbers etc. You might also want that all the posts entries have the same layout and that they look the same on the website. As an example, consider the menu items on a restaurant’s website, it needs to have a common layout but added features than a normal post.

If you are still confused on when to use custom post types, then follow the guidelines below to decide:

  • You publish diverse types of content like blog entries and recipes.
  • You want to distinguish a specific type of content in the way it is structured and displayed. For example: a blog and a portfolio.
  • If some content does not fit a chronological order like a company blog and style guides.
  • If a content type is isolated and can be moved to a different website and remain comprehensible. For example, a list of sold products.
  • If your content is not complicated and does not require using categories and tags. For example, movie reviews.

The simplest approach to create custom post types in WordPress is to use WordPress custom post type plugins. It is safe and easy and recommended for beginners. There are a number of plugins available that make creating custom post types easy and give incredible results. here at Templatetoaster WordPress theme builder, shocases list of a few WordPress custom post type plugins that are worth trying out.

List of the best WordPress Custom Post Type Plugins

  1. Custom Post Types Unlimited plugin
  2. Custom Post Type UI
  3. Toolset Types
  4. Custom Post Types and Custom Fields creator – WCK
  5. Custom Post Type Maker
  6. CPT-onomies
  7. MB Custom Post Type
  8. Custom Post Type Generator
  9. Pods

First, Let us look at a brief comparison of these WordPress plugins w.r.t what features each provides for supporting custom post types.

Comparison Chart of Best WordPress Custom Post Type Plugins (2020)

Best WordPress Custom Post Type PluginCustom Post Type UIToolset TypesWCKCustom Post Type MakerCPT-onomiesMB Custom Post TypeCustom Post Type Generator
Active Installs400,000+200,000+20,000+8,000+4,000+2,000+2,000+
Rating4.64.34.74.64.955
UI for Creating New CPTsYesYesYesYesYesYes, via extensionsYes
Recommended Skill LevelSome PHP knowledgeBeginnerSome PHP knowledgeBeginnerBeginnerSome PHP knowledgeSome PHP knowledge
Custom Post TypesYesYesYesYesYesYes, via extensionYes, using generated code
Display CPTNoYesYesNoYesYesNo
Add Existing Taxonomies to CPTsYesYesYesYesYesYesNo
User InterfaceEasySlightly trickyEasyEasyEasyEasyEasy
Post Type RelationshipsNoYesYesYesYesNoNo
ExportYesYesYesYesNoYesYes, to PHP code

If you want to compare advanced features of the WordPress Custom Post Type Plugins then you can look at the detailed comparison here.

Best WordPress Custom Post Type Plugins (Review)

1. Custom Post Types Unlimited plugin – Best WordPress Custom Post Type Plugin

The Custom Post Types Unlimited plugin allows you to add your own custom post types and taxonomies to your website via the WordPress admin. All post type and taxonomy parameters (label, custom menu name, icon, slug, etc) are available when adding or editing items.

Pros:

  • Easy to get started
  • Add unlimited post types/taxonomies
  • Uses core WordPress interface
  • Not ads or “pro” version upsell – the plugin is completely FREE
  • Developer friendly (hooks available to add your own settings to admin)

Cons:

Wordpress Website Templates

  • No options for adding custom fields to your post types

2. Custom Post Type UI – best WordPress Custom Post Type Plugin

The “Custom Post Type UI” plugin provides an easy to use interface to create custom post types and taxonomies in WordPress.

Pros:

  • Intuitive and detailed UI that is simple to use.
  • Intuitive and detailed UI that is simple to use.
  • You can add custom post types to built-in or custom taxonomies.
  • Support for various available post editor features.
  • A separate listing for custom post types and taxonomies registered by the plugin.

Cons:

  • This WordPress custom post type plugin simply creates the types and you need to add them to the theme yourself. As such display of the CPT is not handled.
  • The plugin lacks the description for some of the more complex options.
  • It does not provide the built-in feature of adding custom fields.

3. Toolset Types – Custom Post Types, Custom Fields and Taxonomies

Toolset allows you to create custom post types, custom fields and custom taxonomies without any PHP coding making it a great option for beginners and expert developers hoping to save time when building their websites.

Pros:

  • Toolset offers the ability to create post relationships which make it easier to manage your website by connecting relevant posts with each other. You can also add repeatable field groups to your custom fields so you can repeat a set of fields in just one click.
  • Toolset has recently released Toolset Blocks which gives you the chance to create blocks with dynamic content using the Gutenberg editor. You can also easily build your custom post type templates, archives and searches using Toolset Blocks.
  • Toolset is completely integrated with a host of popular plugins including WooCommerce, WPML and Elementor as well as major themes including OceanWP and Astra.
  • Not only that but Toolset enables you to create other complex features including a custom search, front-end forms, sliders and maps.
  • If you’re looking for a plugin which supports custom post types and gives you the chance to add important features every custom website needs then Toolset is a great option.

4. Custom Post Types and Custom Fields creator – WCK

The “WCK Custom Post Type Creator” is a WordPress custom post type plugin that provides creating custom post types with a UI that supports most of the arguments of register_post_type() function.

Pros:

  • With a straightforward interface, this is perhaps the simplest WordPress custom post type plugin.
  • The WordPress custom post type plugin lets you create and maintain custom post types, custom taxonomies and custom fields and Meta boxes for posts, pages or custom post types.
  • Quick Startup Guide on “General Settings” page.
  • You can organize the admin with different post types and display theme.
  • Available Pro version with added features and functionalities.

Cons:

  • With the free version, there is undue bloatware as advertisements for the Pro version.

5. Custom Post Type Maker – WordPress Custom Post Type Plugin

“Custom Post Type Maker” plugin lets you create custom post types and custom Taxonomies in a user-friendly way. It fully integrates with the WordPress API and provides support for almost all parameters of the Custom Post Type API.

Pros:

  • Uncluttered UI with separate sections for “Post Types” and “Taxonomies”.
  • It provides you with an interface to manage custom post types like regular post and pages.
  • Provides most features offered by a WordPress custom post type plugin.
  • Lets you set almost all parameters of the CPT API.

Cons:

  • The plugin does not handle the display of custom post types and taxonomies.
  • This plugin has not been updated for quite some time. As such it is not widely used and not active on many WordPress sites.

6. CPT-onomies: Using Custom Post Types as Taxonomies

“CPT-onomies” is a multisite compatible WordPress custom post type plugin that supports the creation of very powerful taxonomies and very powerful relationships between posts.

Custom

Pros:

  • Enables you to use the custom post types as taxonomies and create relationships between posts.
  • The custom post type manager allows the creation of custom post types and registration of CPT-onomies without any added coding.
  • Supports registering other custom post types created with other plugins and themes.
  • Support for a multisite network. One can register custom post types/CPT-onomies across an entire network or selected sites.

Cons:

  • As of now, not all WordPress taxonomy features are supported for CPT-onomies.

7. MB Custom Post Type

The “MB Custom Post Type” plugin lets you create and manage custom post types and taxonomies easily with an easy-to-use interface.

Pros:

  • This WordPress custom post type plugin supports all post type’s arguments with no need to write custom PHP code.
  • It is lightweight, powerful and easy-to-use.
  • Supports live editing mode, which fills the necessary labels for you automatically.
  • Import/Export support for registered custom post types.
  • It can be extended with extensions.

Cons:

  • Needs install of the MetaBox plugin.

Bonus WordPress Custom Post Type Plugins

8. Custom Post Type Generator

The WordPress custom post type generator plugin lets you generate custom post types from the WordPress admin which is very easy to understand.

Pros:

  • Easy to use interface.
  • Provides option to generate PHP code for including WordPress custom post types and taxonomies in themes and WordPress custom post type plugins.
  • Lists custom post types, built-in types and theme supported types separately.

Cons:

  • Registered custom post types and taxonomies do not appear in the list of editable objects in the UI.

9. Pods – Custom Content Types and Fields

With the Pods WordPress custom post type plugin, you can create any type of content irrespective of its complexity. With an easy to use interface, you can manage custom fields and content types.

Pros:

  • Intuitive user interface.
  • This is the most option-rich and robust WordPress custom post type plugin.
  • You can create completely new content types including Custom Post Types, Custom Taxonomies, and Custom Settings page.
  • You can add custom fields to custom taxonomies too.
  • Can create Advanced Content Types that use their own database tables.
  • WordPress plugin also gives you the power to extend existing content types like Post Types, Taxonomies, Media, Users, and Comments.

Cons:

  • It is complicated and even with an impressive documentation might not be easy to use for a beginner.

Manually Creating a WordPress Custom Post Type

It is to be noted that the custom post types will disappear if the plugin is deactivated. The data pertaining to the custom post types is retained. However, the custom post type will be unregistered and inaccessible from the admin area.
Let us look at alternate ways to create custom post types manually.

How to Create Custom Post Types

To create a new custom post type, you will need to use the register_post_type()function from WordPress:

This function allows you to create a new post type by its labels, supported features, availability and other parameters.

The register_post_type() function accepts two parameters:

  • $post_type – The name of the post type.
  • $args – An array of arguments that define the post type.
Template

Let us now look at an example to create a custom post type. You can register a post type in two places:

  • Inside the functions.php file for the theme.
  • Inside a custom Plugin

It is recommended to register a custom post type in a plugin since you will avoid losing the post type registration when you switch themes.

Code to register a post type “products” in a theme’s functions.php:

Custom

In the WordPress admin dashboard, a new menu called Products is added as shown below.

This wordpress custom post type plugins also adds the admin UI for the new custom post type. The new menu item allows adding new product entries or editing existing ones like posts and pages in WordPress. This is a simple example, but the complexity of your custom content would determine the different arguments you can pass to this function. Refer to the codex wiki for more details on the arguments accepted by this function.

Display Custom Post Type Data with WP_Query()

If you want to display custom post type data then you can use WP_Query()to get custom posts within the Loop. The WP_Query()function accepts a post_type parameter that determines the content type to return. In the example below, we display all product entries in WordPress.

How to Display Custom Post Type Category in WordPress

For your custom post types, you may want to display custom categories like the WordPress default post categories.

Firstly, you will need to attach the Category taxonomy to the custom post type. By default, there are no taxonomies attached to a custom post type. You need to add an additional argument ‘taxonomy’ set to ‘category’, to the function register_post_type().

The category pages by default display only the ‘Posts’ post type. To display your custom post types also on the same page, you need to add additional code to the theme’s functions.php file or your custom plugin.

Category Page displaying default post types

Category Page displaying custom post types

You can also display categories for a custom post type. To display the custom post type category, you need to define the taxonomy argument. Then send it to the wp_list_categories() function that is used to list categories.

WordPress Custom Post Type Templates

WordPress themes support custom templates for custom post types. Custom templates are supported for the single display of custom posts and archive displays. By default, WordPress will use the existing theme files that would be archive.php, single.php and index.php files. If you want to create a custom template for your custom post type, make a copy of the existing php file and edit that. WordPress follows a template hierarchy and uses the template it first comes across.

Default Custom Post Type Templates in WordPress

  • single-{post-type}.php

The single post template is used when a viewer requests a single post from a custom post type. The single.php template file will be used if the single-{post-type}.php is not present.

  • archive-{post-type}.php

The archive post type template is used for requests for a custom post type archive. The archive.php template file will be used if the archive-{post-type}.php is not present.

  • search.php

The search results template is used to display the search results. To include search results from the custom post type, add the ‘pre_get_posts’ as shown above.

  • index.php

The index.php is used if the above specific query template for the custom post type is not present.

Which WordPress Custom Post Type Plugin is best for you ?

WordPress custom post type plugins are an extremely powerful feature of WordPress. There’s no limit to the extensibility that you can achieve on your website. If you are an experienced developer, then you can use the WordPress functions directly to create and manage custom post types. You can also choose to use one of the many WordPress custom post type plugins that provide much more than the basic functionality. Lastly, you can try the TemplateToaster, a WordPress theme creator tool which provides enhanced themes and features to create websites with all the custom features you may need.

Best Drag and Drop interface to Design stunning WordPress Themes

Topics

  • Default Post Types

There are many different types of content in WordPress. These content types are normally described as Post Types, which may be a little confusing since it refers to all different types of content in WordPress. For example, a post is a specific Post Type, and so is a page.

Internally, all of the Post Types are stored in the same place — in the wp_posts database table — but are differentiated by a database column called post_type.

Wordpress Custom Post Template Plugin

In addition to the default Post Types, you can also create Custom Post Types.

The Template files page briefly mentioned that different Post Types are displayed by different Template files. As the whole purpose of a Template file is to display content a certain way, the Post Types purpose is to categorize what type of content you are dealing with. Generally speaking, certain Post Types are tied to certain template files.

Default Post Types Default Post Types

There are five default Post Types readily available to users or internally used by the WordPress installation:

  • Post (Post Type: ‘post’)
  • Page (Post Type: ‘page’)
  • Attachment (Post Type: ‘attachment’)
  • Revision (Post Type: ‘revision’)
  • Navigation menu (Post Type: ‘nav_menu_item’)

The Post Types above can be modified and removed by a plugin or theme, but it’s not recommended that you remove built-in functionality for a widely-distributed theme or plugin.

The most common post types you will interact with as a Theme Developer are Post, Page, Attachment, and Custom Post Types. It’s out of the scope of this handbook to flesh out the Revision and Navigation Menu Post Types. However, it is important to note that you will interact with and build the functionality of navigation menus and that will be detailed later in this handbook.

Post Post

Posts are used in blogs. They are:

  • displayed in reverse sequential order by time, with the newest post first
  • have a date and time stamp
  • may have the default taxonomies of categories and tags applied
  • are used for creating feeds

The template files that display the Post post type are:

  • single.php and single-post.php
  • category.php and all its iterations
  • tag.php and all its iterations
  • taxonomy.php and all its iterations
  • archive.php and all its iterations
  • author.php and all its iterations
  • date.php and all its iterations
  • search.php
  • home.php
  • index.php

Additionally, theme developers can display Post post types in front-page.php if they so desire.

Read more about Post Template Files.

Page Page

Pages are a static Post Type, outside of the normal blog stream/feed. Their features are:

  • non-time dependent and without a time stamp
  • are not organized using the categories and/or tags taxonomies
  • can have page templates applied to them
  • can be organized in a hierarchical structure — i.e. pages can be parents/children of other pages

The template files that display the Page post type are:

  • page.php and all its iterations
  • $custom.php and all its iterations
  • front-page.php
  • search.php
  • index.php

Read more about Page Template Files.

Attachment Attachment

Attachments are commonly used to display images or media in content, and may also be used to link to relevant files. Their features are:

  • contain information (such as name or description) about files uploaded through the media upload system
  • for images, this includes metadata information stored in the wp_postmeta table (including size, thumbnails, location, etc)

The template files that display the Attachment post type are:

  • MIME_type.php
  • attachment.php
  • single-attachment.php
  • single.php
  • index.php

Read more about Attachment Template Files.

Custom Post Types Custom Post Types

Wordpress Blog Post Template

Wordpress Custom Post Template

Using Custom Post Types, you can create your own post type. It is not recommend that you place this functionality in your theme. This type of functionality should be placed/created in a plugin. This ensures the portability of your user’s content, and that if the theme is changed the content stored in the Custom Post Types won’t disappear.

You can learn more about creating custom post types in the WordPress Plugin Developer Handbook.

While you generally won’t develop Custom Post Types in your theme, you may want to code ways to display Custom Post Types that were created by a plugin. The following templates can display Custom post types:

  • single-{post-type}.php
  • archive-{post-type}.php
  • search.php
  • index.php

Additionally, Theme Developers can display Custom Post Types in any template file, often by using multiple loops.

Read more about Custom Post Type Templates.