Earlier this year we wrote tutorial about custom post formats, in which we explained that they are different from custom post types.
That led some people to scratch their heads ... "what's the difference between post formats and post types?".
Many people confuse the two. In this tutorial we're going to explain custom post types, and give you some ideas on how to use them.
What are the default post types?
There are five major types that WordPress uses by default - post, page, attachment, revisions, nav menus. Now you can define your own post types. For instance, suppose you wanted to create a movie database that would be search able by your visitors. Or a catalog of cars listed by manufacturer. You can now create a post type called movies or cards, and give it it's own categories and tags (using taxonomy) and then create a menu item that will display your listings. Your new custom post types will also be visible in searches.
A "post" in WordPress is the main type used by the blog. Posts are normally displayed in the blog in reverse sequential order by time (newest posts first). Posts are also used for creating the feeds.
A "page" in WordPress is like a post, but it lives outside the normal time based structure of posts. They have their own URLs directly off the main site URL. They can also use special Page Templates to display them. Pages can also be organized in a hierarchical structure, with Pages being parents to other Pages.
An "attachment" is a special post that holds information about files uploaded through the Media upload system. They hold all the description and name and other information about uploaded files. For images, this is also linked to metadata information about the size of the images and thumbnails generated from the images, the location of the files, and even information obtained from EXIF data embedded in the images.
A "revision" is used to hold draft posts as well as any past revisions of existing posts or pages. These are basically identical to the main post/page that they are for, but have that post/page as their parent.
The "nav_menu" type holds information about a single item in the Navigation Menu system. These are the first examples of entries in the posts table to be used for something other than an otherwise displayable content on the blog.
What are custom post types?
Calling them post types is misleading. It makes you think these are posts. Posts are made to be displayed in reverse chronological order. It's the essence of a blog. Custom post types are really pages. Here are the big differences:
Pages and Custom Post Types both:
Custom post types are great for people developing plugins. It's a way for plugins to define types of content for the plugins. Now WordPress puts the development of these custom post types in the hands of the administrator so you can create pages the way you want. The result is similar to a plugin in that you now have a "movie" content type with it's own taxonomy, it's own links, and even it's own design and format.
Custom post types give you a new content type
When you add a custom post type, WordPress automatically adds new controls in the tool bar. You can see here we have a new section called Movies, and we've added taxonomies for actors and directors. You will no longer need to take a post or a page and use workarounds to make it into a movie listing. You will be able to create a dedicated movie listing, and call up the content from custom menus and links.
Use your imagination on what this might mean to you. You could make a product page, for instance, and use taxonomies to classify color, style and size. If you were doing computer reviews, you could have a computer post type and you could display a profile of computer features, and make it so people could find computers with Windows XP operating systems.
Custom post types is another tool that brings WordPress closer to a full-featured CMS. With the ability to create custom post types, together with custom taxonomies (see our tutorial on taxonomies), you can create shopping carts, product catalogs, directories and much, much more.
This is just a brief explanation of what custom post types can do for you. We'll be doing more tutorials on custom post types, and taxonomies showing you how to get the data integrated into your site, how to create links and searches and other useful techniques.
Now that you know what custom post types are, why not move on to this next tutorial and try to create some for yourself?
With Admincredible you can update and manage all your Joomla sites. If you have 5 or 500 sites, Admincredible will make your life easier! Visit Admincredible.com.
All of our tutorials are published under the Creative Commons Attribution-NonCommercial license. This means: