How To Create Custom Post Types in WordPress

Custom post types are one of the more useful features in WordPress. Especially if you’re looking for a way to extend your favorite blogging platform into a fully-fledged content management system.

Here’s what I mean:
By default, WordPress provides you with a handful of built-in content types. The most commonly known ones are posts and pages. Under the hood, they behave quite the same, but they give you the opportunity to organize the content of your site in a more reader-friendly manner.

In the most classic of examples:
  • you can use pages to display the content that rarely changes and remains evergreen (such as About page or Contact page),
  • and then use posts to publish entries that might have an expiration date on them (like company news and blog posts).
But what if you need more? What if you want to publish other content that’s neither a page, nor a post? That’s where custom post types in WordPress come into play. For any instant support wordpress user may call on customer service phone number 1855-925-7088

What are custom post types?

Like I said earlier, WordPress provides you with a handful of content types by default. They are: posts, pages, attachments, revisions, and navigation menus. Those last three are something we don’t need to discuss right now. They serve their purpose quietly in the background of WordPress, and they don’t require much attention on our part.

Read also: Unable To Login WordPress Admin Dashboard

Posts and pages is where the party takes place!

From a technical point of view, they work very much alike, and the main difference between them is that posts can be accessed from your wp-admin through the Postsmenu, while pages can be accessed through Pages.
posts-pages

These two were the classic content types available in WordPress until version 3.0 came along. In it, users were given a possibility to create their own content types, above the standard posts and pages.

Such a new content type – defined by you – will appear in the wp-admin right below the Posts and Pages menus in the sidebar. And, most importantly, you will be able to work with that new content type just like you would with posts and pages.

So the question is:

Why / when would you need to use custom post types?

Custom post types can help you in many situations, based on the type of content you want to publish on your WordPress site.

Most commonly, a new custom post type is a good idea when you simply want to start publishing something (a type of content) that needs to be kept apart from posts and pages. In other words, you want to present that something neither as posts, nor as pages.

Read Also: Protect Your WordPress Website’s Login Page

Let me just give you a quick example:

If you run a book review site then you can probably use a custom post type called books.

Having separate section for books on your review site is going to make the content more digestible for your audience, and distinguish those reviews from the rest of your content. Additionally, this will also enable you to set specific parameters for each book – such as author or genre – and display it alongside the review.

How to create a new custom post type in WordPress

Okay, let’s get to the how-to. There are two main methods to create custom post types in WordPress:
a) the manual method,
b) the simplified method.

The one we’re going to cover in this guide is the latter – the simplified method. In short, it gives you the same result as the manual method, but it requires no coding skills from you at all.

The simplified method of creating custom post types in WordPress

We’re going to use a certain plugin for this. It’s called Easy Content Types.

easy content types
  • Like with most plugins, to get it running, all you need to do is download the archive from this page, and then upload it through Plugins / Add New in your wp-admin:
add a plugin
  • After activating the plugin, you can go straight to Content Types / Post Types, and start using the plugin:
content types main panel

What you see here is the main configuration page of your new custom post type – the one you want to have created.

Every field is very well described, so you shouldn’t have any trouble setting things up. Just as an example, here are my inputs:
  • Post Type Name: book.
  • Singular Label: Book.
  • Plural Label: Books.
  • Everything else left to default values.
After clicking the Add Post Type button at the bottom, I’m all done!
custom post types - add new
Here’s my new custom post type:
custom post types - books
  • It’s also visible in the left menu, right below Posts:
books-menu
  • At this stage, I can go to Books, and create a new one, just like I would create a new post:
book-add-new
  • Let’s add an example book and see how this plays out:
book-publish
  • All I did here was add some basic book details, such as title, some quick description, a featured image (the cover), and click Publish.
  • My book is now visible in the Books section, and I can also see it in all its glory by clicking the View link:
book-view-link
Here’s what it looks like on the site (my example setup uses the Twenty Fifteen theme):
book-front
Quite nice, isn’t it?
What’s great about this plugin in particular is that it doesn’t force you to deal with any code-related details. It takes care of all the heavy lifting for you. In the background, it quietly creates all the required template files, adjusts all the function settings, and a couple of other things that make this possible.

But there’s more:

Setting taxonomies – how and why

Taxonomies are WordPress’ fancy name for things like categories and tags. In other words, categories and tags are taxonomies.

However, the standard categories and tags in WordPress relate to posts, and not to your new custom post types. Therefore, it might be a good idea to create new taxonomies just for those custom content types.

In a possible usage scenario, this can let you categorize your books. You can put some books in fiction, and others in non-fiction, for example, Or whatever else you want to do.
  • To set this, go to Content Types / Taxonomies:
taxonomies
What you’ll see is another settings panel with each option very well described. The minimum you have to fill out are:
  • Taxonomy Name. I’m calling mine genre.
  • Object. I’m going to select “book” since this taxonomy relates to my new custom post type – books.
  • Singular Label – Genre.
  • Plural Label – Genres.
  • Everything else left to default values.
After clicking Add Taxonomy at the bottom, you’re all done.

Meta boxes – adding parameters to your custom content types

Now, our books look all fine and dandy, but let’s make them look even better! For that, let’s use the meta box feature in Easy Content Types and add a box called “Rating.”

  • Let’s go to Content Types / Meta Boxes:
meta-boxes
  • The setup is very simple here as well. All I’m going to do is set my Metabox Name to “Rating”, my Page(s) to “Books”, and the Context to “side”. Like so:
meta-box-setup
  • Next, let’s edit the fields associated with this new meta box:
meta-fields
  • This is where we can set the individual fields that we want to have displayed in the Rating box. For me, just a field called Rating will do:
add-field
At this point, I get two things:
  • I can add my rating to every book. Like so:
rating-book
  • I can display that rating to my readers through a simple shortcode. Easy Content Types gives you the shortcode as soon as you add a new field to your meta box:
shortcode

Conclusion

In the end, custom post types are a great way to add new content types to your WordPress site.

You can use those content types for any purpose you wish, and whenever you find yourself in a situation that calls for more content types than just posts and pages.

For instance, like I did here, you can start publishing book reviews, product infos, movie ratings, or whatever else you find interesting. That’s the whole point – using WordPress in a way that suits your individual needs.

And with all that in mind, Easy Content Types surely makes dealing with custom post types very easy to grasp for everyone. Check it out.

Comments