PDA

View Full Version : About WordPress 3.0 Custom Post Types



adultblogbuilder
09-24-2010, 05:00 AM
http://www.adultblogbuilder.com/images/wordpress_button.gifThe following excerpt is from a very detailed tutorial about what custom post types are, and what you can do with them by Justin Tadlock (http://justintadlock.com).

<blockquote>One of the things I’ve been hoping would be implemented in WordPress for years is the ability to create custom content types. The inability to do this has been WordPress’ weakest point when compared to rivals in the CMS market.

In WordPress 3.0, we’ll have the capability to easily create and manage content via custom post types. Not only that, but you won’t have to rely on a plugin to do this for you. It can be done via your theme’s functions.php file with a few lines of code.

There are other 3.0 features such as menu management and multi-site, but this is the most promising feature coming. In this tutorial, I’ll walk you through the creation of custom post types and how they can be used for your blog.

What are custom post types?
Don’t be confused by the term “post” in the name. It is actually an extremely generic term and should not be considered the same thing as a blog post. If you prefer, you can replace it with “content” instead.

Custom post types don’t have any strict rules that define what they are. They can represent any type of content you want. For example, WordPress ships with several default post types.

Blog Posts
Pages
Attachments
Revisions
Nav Menus (WordPress 3.0)

You should think of them as a way to create, edit, and store information in the same way as blog posts but with much more creative control.

One thing I would warn against is trying to separate your blog posts in this way. You have categories, tags, and custom taxonomies at your disposal if you’re just looking for a way to label them.

Ideas for custom post types:
While WordPress ships with some good default post types that are great for most sites, some of us need alternatives. I’ll list some things below that I think would be useful and link to examples if I can.


Real estate listings.
Event calendar (I know a lot of folks are interested in this).
Movie Database (http://popcritics.com/movies/)
Book Database (http://popcritics.com/books/)
A forum (http://justintadlock.com/blog/wp-content/uploads/2010/04/forum-post-type.png)without a lot of integration problems.
A ticket system (http://justintadlock.com/blog/wp-content/uploads/2010/04/issue-tracker.png) like the WordPress Trac.
Design