How To Add Custom Post Types In WordPress

Hi Friends , Custom post types is one of the main feature of wordpress 3.0. By custom post types you can create any section like post and pages, means you can creat any section exists in your site. Just for example if you have section in your site News then you can create News section by putting a simple code in theme function file and it will create News Section in admin. So in this example I am showing you how we can create custom post types Products in your wordpress.

So below is code to create custom post type products:

add_action('init', 'movies_register');
function movies_register() {
$args = array(
'label' => 'Products',
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => 'products'),
'query_var' => true,
'supports' => array(
'title',
'editor',
'excerpt',
'trackbacks',
'custom-fields',
'comments',
'revisions',
'thumbnail',
'author',
'page-attributes')
) ;
register_post_type('products', $args);
}
Now to add custom post type, Go to your current theme and open function.php of your current theme and put above code in your functions.php file and check your admin. You will see one more section Products automatically appeared in menu like shown below.
There are so many options for register_post_type available, So you can check it here