Skip to content

Instantly share code, notes, and snippets.

@themepaint
Last active August 29, 2015 14:18
Show Gist options
  • Save themepaint/7465bf1edbb827d9a539 to your computer and use it in GitHub Desktop.
Save themepaint/7465bf1edbb827d9a539 to your computer and use it in GitHub Desktop.
Register Custom Post Type
<?php
/*Register Custom Post Type*/
function tp_custom_portfolio(){
$labels=array(
'name'=>__('Portfolios'),
'singular_name'=>__('Portfolio'),
'add_new'=>__('Add New Portfolio'),
'edit_items'=>__('Edit Portfolio'),
'new_item'=>__('New Portfolio'),
'new_item' => __( 'New Portfolio', 'tp_portfolio_tx' ),
'edit_item' => __( 'Edit Portfolio', 'tp_portfolio_tx' ),
'view_item' => __( 'View Portfolio', 'tp_portfolio_tx' ),
'all_items' => __( 'All Portfolio', 'tp_portfolio_tx' ),
'search_items' => __( 'Search Portfolio', 'tp_portfolio_tx' ),
'parent_item_colon' => __( 'Parent Portfolios:', 'tp_portfolio_tx' ),
'not_found' => __( 'No Portfolios found.', 'tp_portfolio_tx' ),
'not_found_in_trash' => __( 'No Portfolios found in Trash.', 'tp_portfolio_tx' )
);
$args = array(
'labels' => $labels,
'description' => '',
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'portfolio' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type('tp_portfolio',$args);
}
add_action('init','tp_custom_portfolio');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment