Like
Like Love Haha Wow Sad Angry
1

Understanding custom post types and custom taxonomies can open up a whole new world of possibilities for WordPress users. However, as they can’t be created through the WordPress settings and admin pages, many users aren’t even aware of their power.

Whether you are totally new to custom post types and taxonomies, or you’ve heard of them but aren’t using them on your site yet, by the end of today’s post you will have been brought up to speed on this topic, have found out how they can help improve your website, and also have learned how to easily create them using a free plugin.

What are Custom Post Types?

Posts and pages are two post types that are a core part of WordPress. However you can also create your own custom post types which can be used to store different types of content.

For example, you could use pages to publish information about your website; posts be used for your blog; while an additional custom post type could be used for publishing your products.

This allows you to keep the different types of content separate on your website, while also giving you the ability to present and organize it all in different ways.

Custom Taxonomies

While we’re on the subject of custom post types it makes sense to include custom taxonomies. Categories and tags are the default taxonomies found in WordPress.

However you can create custom taxonomies which can also be used to organize and classify your content in other ways. For example if you were a travel blogger you could create a taxonomy called location, and then use it to categorize your posts by the location they cover.

By using a new taxonomy instead of the default category taxonomy, you can organize your content more efficiently and make it easier for your visitors to filter and find the content they are looking for.

Typically when creating a custom post type, users also create custom taxonomies just for use with that new post type. However, this isn’t a requirement and new post types can use the default WordPress category and tag taxonomies; while custom taxonomies can be used by the standard WordPress post type.

Examples of Custom Post Types and Taxonomies

A popular use of custom post types and taxonomies can be found on eCommerce stores built with WordPress. The popular WooCommerce online shop plugin for WordPress adds a new post type called products. This product post type also has its own set of taxonomies to organize those products.

WooCommerce plugin backend
WooCommerce plugin backend

This is a great way to not only keep the products separate from the rest of the website content, but also to present that content in a different way.

WooCommerce plugin frontend
WooCommerce plugin frontend

One recent example where I was able to use custom post types to save a lot of time and make it easier to organize and manage the different types of content on a site is these interactive learning resources.

By using custom post types each new resource is kept separate from the regular blog posts on the site. This also makes it easier for visitors to browse and navigate the resources without being distracted by the other types of content. The resources also have their own custom taxonomies, helping to make it even easier to organize and navigate this content.

Creating the custom post types and custom taxonomies with a free plugin took less than a few minutes, but their creation will save countless hours when it comes to planning the site structure and organizing the content.

How to Create a Custom Post Type

Of course you can create a custom post type manually by registering it on your site by making a PHP file for the new post type. However, while its always a good idea to have an understanding of what is going on the background of your website, if you want a faster and more efficient way of creating and managing custom post types the free Types plugin is just what you need.

This free plugin gives you a visual interface for creating custom post types and custom taxonomies, removing the need to write any code yourself. Once the plugin is installed, clicking on the Types & Taxonomies menu item on the Types submenu will take you to the page where you can create and manage your custom post types and taxonomies.

Manage your custom post types and taxonomies
Manage your custom post types and taxonomies

From here you can create new custom post types and taxonomies and view any that you’ve created previously with the plugin.

Naming Your New Post Type

To get started, click on the Add Custom Post Type button. From this screen you can create a custom post type through a visual interface, as opposed to writing the necessary PHP code by hand.

Create a custom post type
Create a custom post type

The first set of fields requires you to enter a name for your new post type in both singular and plural forms. This is necessary as once the post is created, WordPress will display links to the post type, so for those links to make sense you need to supply both versions. An example of this would be Add New Post and View All Posts.

The slug is another required filed. The slug should be one, or a few hyphenated words without spaces, that describe the post type. The slug will also be used as part of the URL when listing the posts of this type.

For example if you wanted to display all the content on your site in this post type on a single page, you could use the URL http://www.yousite.com/this-slug/

As you cannot use the same slug twice on a single WordPress site, try to choose something unique that you won’t need or want to use elsewhere on your site.

Choose an icon for your new post type
Choose an icon for your new post type

You can also choose an icon for your new post type from the list of options. This is only displayed on the back end of your site, but it can make it easier to identify each of the different post types at a glance, especially when the sidebar menu is collapsed.

Set the Visibility

The next set of options gives you the ability to set the visibility of the post type and whether or not it will appear in the WordPress admin menu. If you don’t want registered users to be able to use or edit the content held in this post type then select hidden. Everyone else should stick with the default value and make the post type public.

Select Taxonomies

From the select taxonomies options you can define which existing taxonomies, such as categories, tags, and any custom taxonomies that are present on your site this new custom post type can make use of.

Select Taxonomies
Select Taxonomies

In most cases you will want to create at least one custom taxonomy for your new post type. This will allow you to organize this content using custom categories or tags that are separate from those that are used by the default WordPress post type.

Organize content using custom categories or tags
Organize content using custom categories or tags

For example if you were creating a custom post type to contain the reviews you are publishing on your blog, you could create a custom taxonomy titled genre. This would allow you to organize and classify those reviews by genre, helping your readers to then filter your reviews using this taxonomy.

If you haven’t yet created a new custom taxonomy for this post type yet then skip this section as we will cover how to create a new taxonomy later.

Customize the Labels

The next section contains the labels that are used by the WordPress menus and navigation system on the admin dashboard. It’s fine to use the default settings, but feel free to edit the labels if it makes sense to do so.

Customize the Labels
Customize the Labels

For example you can change Add New to Submit New if it’s more appropriate for your post type and website.

Display Sections

Through the display sections options you can determine which fields, sections, and options are displayed on the screen when you are creating content for this new post type.

Display Sections
Display Sections

This doesn’t disable these features for your post type, but rather hides the element from the post editor screen. For example if you uncheck the comments box, the comment form will still be displayed when your post is published, but the comments options panel on the post editor screen won’t be displayed.

For most post types you will probably want to at least display the post title field and the editor input box for writing your content. However there are no rules here and it will depend on what you are using the custom post type for.

Advanced Settings

The advanced settings give you more control over how your new post type functions on your website. While you can leave these settings at their default values, you can also use them to:

  • Create an index page which lists the posts of this type
  • Show the post type in the admin menu
  • Exclude from search
  • Make the post type hierarchical with parent and child relationships

Once you’ve worked your way through the settings you can click the Save Custom Post Type button to create the post type.

You should now see a new menu item added to the admin sidebar with the same name as the post type you created. From there you can add new content using that post type.

If you want more detailed instructions on using the Types plugin the extensive online documentation is very helpful.

Creating a Custom Taxonomy

If you do decide that your new post type would benefit from a custom taxonomy then you can quickly create one with the Types plugin.

From the Custom Post Types and Taxonomies screen, clicking on the Add Custom Taxonomy button will allow you to get stated. Like creating a new post type, you must enter the singular and plural version of the name of new taxonomy, and also create a slug to describe the taxonomy.

Add new taxonomy
Add new taxonomy

After deciding whether to make the taxonomy visible on the admin menu or not, you can then select which post types can use this new taxonomy.

Select which post types can use a new taxonomy
Select which post types can use a new taxonomy

The labels and advanced options work in a similar way to those on the custom post creation page. However, with taxonomies you can choose to make them either hierarchical or flat.

Make taxonomies flat
Make taxonomies flat

If you choose hierarchical your taxonomy will function like the default WordPress category; while choosing flat will cause it to function like the default WordPress tag taxonomy.

Make taxonomy hierarchical vs flat
Make taxonomy hierarchical vs flat

Custom Fields

The Types plugin also allows you to create and work with custom fields which can then be added to the default WordPress post types as well as any custom post types you create.

Although custom fields are a topic for another day, it’s worth mentioning this feature because custom fields are a powerful way to make your post types even more customized; allowing you to add extra information to your posts which is known as meta-data. The Types plugin includes support for a range of custom fields including:

  • Text fields
  • Checkboxes, radios, and lists
  • File uploads and images
  • Dates
  • Contact details and URLs

By enabling these fields you can add additional content to your posts from the post editor page in dedicated fields, which can then be presented in a format of your choice on the front end of your website when the post is published.

A great example of custom fields in action is the review posts that are created by the Rich Snippets plugin. The custom fields look like this on the back end:

Custom fields backend
Custom fields backend

Once published, the contents of the fields are presented like this on the front end:

Custom fields frontend
Custom fields frontend

Although this is an advanced use of custom fields and you could start off with something smaller such as adding a button or image to your posts.

Drawbacks of Custom Post Types

One drawback of using custom post types on your website that you might encounter is that some plugins and widgets that you might use don’t support any posts types other than the default WordPress post type.

For example you might be used to using the recent posts widgets that is part of WordPress core, or a featured posts widget, to display the latest content published on your website in the sidebar of your site or on its homepage.

However, as these widgets don’t work with non-standard post types they won’t display your custom content. There is usually an alternative option available to solve this problem, but you will need to be aware of this when selecting plugins in the future.

Conclusion

You should now not only know how to create custom post types in WordPress, but also how to use them effectively on your website.

By harnessing the power of this useful feature of WordPress you can organize and present your content in a more manageable way, while also making it easier for your readers to consume.

If you plan to use custom post types or taxonomies on your website please share your ideas in the comments below. Also if you have any questions about this topic, leave a comment and we will get right back to you.

Like
Like Love Haha Wow Sad Angry
1

Joe

As well as being a regular WordPress user, Joe writes for some of the most popular WordPress blogs, sharing what he's learned about this most versatile platform. If you would like to work with Joe to get content for your website, please visit his website for more information.

1 comments

I’m rather new to this information and still trying to grasp general concept. I have to do a list of events on a site. Single event usually doesn’t have any value, it’s a cut of from the sites of event organizers (they send it to us and don’t bother to make anything unique :)) and we delete when the events are finished. So, is it possible that custom post doesn’t show anywhere on the site and only the the results of sorting shows (like events by date or events by location)?