Custom Post Types in WordPress 3.0



This has been something that I have been looking forward to for a very long time. With these options, wordpress mu and buddypress, WordPress is really a cms/blogging software to be reckoned with.

Clients get confused when you install wordpress as a cms for them and they see add a new post, they always get confused with that. With this new feature where it says add a new client, or add new business. Clients will be able to understand easily what they need to do. This will also add the ability to organize much easier within categories and categories within categories.

To add a custom post type in wordpress 3.0 this would go into either a plugin or the functions.php file in your theme directory:

// This function is where the magic happens
function post_type_gallery() {

// this is where we say the post type
register_post_type( ‘gallery’,

// This section tells wordpress what to show when they go to add Gallery. This will only show the subject box, the body box and the publish box.
array( ‘label’ => __(‘Gallery’), ‘public’ => true, ‘show_ui’ => true) ) );

// This action shows the above function in the WordPress Dashboard
add_action('init', 'post_type_gallery');

With that you will have a custom post screen, Way easier than it was before! Everything posted in this gallery section will also only appear in the gallery edit posts section. It should look this this below:

Next will be how to add a custom field to this custom post. It is the same way as before, just a little bit of added code into the register_post_type(First Image).


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>