Custom Post Types
One of the most confusing features of WordPress is custom post types. It is also a useful, powerful, and easy feature to implement and use after you understand how it works. WordPress has five default post types:
- Post: The most commonly used post type. Content appears in a blog in reverse sequential time order.
- Page: Similar to a post, but pages don't use the time-based structure of posts. Pages can be organized in a hierarchy and have their own URLs off the main site URL.
- Attachment: This special post type holds information about files uploaded through the WordPress Media upload system.
- Revisions: This post type holds past revisions of posts and pages as well as drafts.
- Nav Menus: This post type holds information about each item in a navigation menu.
A post type is really a type of content stored in the wp_posts table in the WordPress database. The post type is stored in the wp_posts table in the post_type column. The information in the post_type column differentiates each type of content so that WordPress, a theme, or a plugin can treat the specific content types differently.
When you understand that a post type is really just a method to distinguish how different content types are used, you can investigate custom post types.
Say you have a Web site about movies. Movies have common attributes — actors, directors, writers, and producers. But say you don't want to store your movie information in a post or a page because it doesn't fit either content type. This ...
Get WordPress® All-in-One For Dummies® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.