Join Morten Rand-Hendriksen for an in-depth discussion in this video What is a custom post type?, part of Create an Online Portfolio with WordPress.
- View Offline
By default, WordPress has two main types of content, posts and pages. The posts are further organized based on categories and tags, while the pages are organized in parent-child relationships. This structure is fine if you have a site with, for example, some static pages and a blog, but it does lend itself well to more complicated sites that have multiple types of content. This is where custom post type come in. A custom post type is exactly what it sounds like. A new type of post with its own name, its own selection in the admin menu, and its own templates, taxonomies, and functions.
The benefit of a custom post type is simply that it separates from your regular posts and allows you to put different types of content in different buckets. To show you what I mean, here is a website we build for the 12X12 Vancouver Photo Marathon. It's a photo contest in Vancouver. In that site we needed a way of organizing information about the participants or marathoners, as we call them. So we created a new post type. As you can see in the admin menu, we have posts, we have pages and down here we also have a new item called Marathoners.
When I click on it, you'll see a list of all our marathoners. You can add a new marathoner if you want to. Add new marathoner, with a title, description, and also a bunch of extra custom field information. The marathoner can also be organized based on the year he or she participated. Rather than having a new post and then categories, we have new marathoner and Year. This is a very basic example of what you can do with a custom post type and you can get way more advanced with it, but it shows the general principle.
Instead of having everything under Posts or Pages, we can add additional New types of content in our sidebar that are then handled separately. custom post types allow you to separate the content on your site into different buckets or areas, so they don't get mixed up. More importantly, they allow you to treat different content differently both by organizing them in new custom taxonomies, collecting different kinds of information, and displaying them with custom templates depending on the contents, and that's what we're going to do in this course.
- Exploring online portfolios
- Creating the site architecture
- Incorporating advanced custom post type functionalities
- Hooking a custom taxonomy to a post type
- Understanding how hierarchy relates to taxonomies
- Populating content into custom post types
- Handling multiple post type templates
- Displaying a list of links to the latest custom post type posts
- Building static pages for the front and the blog
- Creating a contact page with a contact form