Code to register the custom post type

Use the following code to register custom the post type

Example

portfolio : Your Custome Post Type Name
function portfolio_register(){
    $labels = array('name'=> _x('Portfolio','post type general name'),'singular_name'=> _x('Portfolio Item','post type singular name'),'add_new'=> _x('Add New','portfolio item'),'add_new_item'=> __('Add New Portfolio Item'),'edit_item'=> __('Edit Portfolio Item'),'new_item'=> __('New Portfolio Item'),'view_item'=> __('View Portfolio Item'),'search_items'=> __('Search Portfolio Items'),'not_found'=>  __('Nothing found'),'not_found_in_trash'=> __('Nothing found in Trash'),'parent_item_colon'=>'');
    $args = array('labels'=> $labels,'public'=>true,'publicly_queryable'=>true,'show_ui'=>true,'query_var'=>true,'rewrite'=>true,'capability_type'=>'post','hierarchical'=>false,'menu_position'=>8,'supports'=> array('title','editor','thumbnail')); 
    register_post_type('portfolio', $args );}
add_action('init','portfolio_register');
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s