Today you’ll learn how to create custom post types in WordPress. As WordPress grows and becomes a more robust content management system, custom post types become more and more important to understand and use.
A Custom Post Type can be any kind of content for a website. By default, WordPress has the following as post types you can create a post, page, attachment, revision, and nav menu as a custom post type.
But, when extending your site’s functionality, you also create custom post types like products for shopping, reviews for a movie review site, testimonials for businesses, portfolios for artists, recipes for a food site and many more.
To create custom post types easily first install and activate the custom post type ui plugin a new post type.
The plugin also allows you to create custom taxonomies as well. For instance, I’m going to create a movie custom post type. I’ll fill out the post type name, label and the singular label like this. Add a description here.
There are some advanced options as well down here. I want to show those and change the has archive to true, but I’ll leave the rest as default settings. I’ll show you why I do that in a minute.
Then we’ll click create custom post type.
Now over here on the right, I’ll also create Custom taxonomy to go with my custom movie post type. We’ll add actors, Label actors, Singular label is actor and I want to attach this to my movies post type.
There are some advanced settings, but we’ll keep the default settings and click create custom taxonomy now. You might have to refresh the page, but you should now see a Movies section on the left in our admin area.
You can click on Add Movie and fill in the information about your first movie.
Add a some information about the movie here. Over here, we can add the actors that played in it.
And then we’ll click publish. Now we can click on the Movies and see a list of all the movies we’ve added so far.
Right now I only have one so I’ll create a few more. Down here, you can click on actors for that list.
Now that we have custom post type movies, we want to be able to show it on our site. When I set the Has Archive to true, that made the post type movie have an archive page.
So now I can go to my site’s url with the custom post type ‘movie’ like you see here at the end and it will show all the movies on one page.
You can even add this page to your menu. From here, I can click on each movie and see the information about the movie.