Custom Post Types are a new set of administrative options appearing along with the default post types such as Posts, Pages, Attachments etc. A Custom Post Type can store any type of information. It has a editor, media uploader and uses the existing WordPress table structure for ease in data management.
By default, WordPress comes with 3 taxonomies:post tag, categories and link categories. Essentially, a taxonomy is a way of classifying data.
You can learn how to create custom meta boxes/meta data of wordpress, check the following link of my previous post.
WordPress create custom meta boxes
ok.Let’s start.First check the following diagram how about the custom post type’s look. I’m going to explain this using “portfolio” custom post type.
Creating a custom post types/taxonomies
Open your theme’s folder functions.php file and add the following codes at the end of that file.
wp-content/themes/yourthemefolder/functions.php
1-Add the following hook to execute the custom function during the initialization phase every time a page is generated.Here ‘my_custom_post_portfolio’ is a custom function name.
add_action( 'init', 'my_custom_post_portfolio' );
2-Create the custom function and add arguments to implement as menu item.
function my_custom_post_portfolio() { $labels = array( 'name' => _x( 'Portfolios', 'post type general name' ), 'singular_name' => _x( 'Portfolio', 'post type singular name' ), 'add_new' => _x( 'Add New', 'portfolio' ), 'add_new_item' => __( 'Add New Portfolio' ), 'edit_item' => __( 'Edit Portfolio' ), 'new_item' => __( 'New Portfolio' ), 'all_items' => __( 'All Portfolio' ), 'view_item' => __( 'View Portfolio' ), 'search_items' => __( 'Search Portfolio' ), 'not_found' => __( 'No Portfolio found' ), 'not_found_in_trash' => __( 'No Portfolio found in the Trash' ), 'parent_item_colon' => '', 'menu_name' => 'Portfolio' ); $args = array( 'labels' => $labels, 'description' => 'Holds Portfolios and Portfolios specific data', 'public' => true, 'menu_position' => 5, 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ), 'has_archive' => true, ); register_post_type( 'portfolio', $args ); }
Explaining…..
register_post_type( 'portfolio', $args );
Registering the custom post type.
'description' => 'Holds Portfolios and Portfolios specific data'
Description about the post type.
'public' => true
Determines the visibility of the custom post type both in the admin panel and front end.
'menu_position' => 5
The menu position of the custom post type.
'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'custom-fields' )
The features of the custom post type which is to be displayed.
'has_archive' => true
Enables archiving of the custom post type.
'menu_icon' => 'menu icon url is here'
Displays the admin menu icon.
After saving the page you can see the result from admin panel.
More details
http://codex.wordpress.org/WordPress_Taxonomy