Skip to content

Instantly share code, notes, and snippets.

@doughamlin
Last active December 14, 2015 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doughamlin/5033709 to your computer and use it in GitHub Desktop.
Save doughamlin/5033709 to your computer and use it in GitHub Desktop.
Register a new content type in WordPress
add_action('init', 'CONTENTTYPE_register');
function CONTENTTYPE_register() {
$labels = array(
'name' => _x('CONTENTTYPE NAME', 'post type general name'),
'singular_name' => _x('CONTENTTYPE NAME', 'post type singular name'),
'add_new' => _x('Add New', 'CONTENTTYPE NAME'),
'add_new_item' => __('Add New CONTENTTYPE NAME'),
'edit_item' => __('Edit CONTENTTYPE NAME'),
'new_item' => __('New CONTENTTYPE NAME'),
'view_item' => __('View CONTENTTYPE NAME'),
'search_items' => __('Search CONTENTTYPE NAME'),
'not_found' => __('Nothing found'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'menu_icon' => get_stylesheet_directory_uri() . '/images/icon_album.png',
'rewrite' => array('slug' => 'ortho-pinion'),
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','categories','thumbnail'),
);
register_post_type( 'CONTENTTYPE' , $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment