Skip to content

Instantly share code, notes, and snippets.

@ammist
Created June 15, 2011 17:03
Show Gist options
  • Save ammist/1027551 to your computer and use it in GitHub Desktop.
Save ammist/1027551 to your computer and use it in GitHub Desktop.
[WP] Create a Custom Post Type
register_post_type('book', array('label' => 'Books',
'description' => 'Books and other items for sale on the Heyday website',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => ''),
'query_var' => true,
'supports' => array('title','editor','excerpt','custom-fields','revisions','thumbnail','author','page-attributes',),
'taxonomies' => array('category','post_tag',),
'labels' => array (
'name' => 'Books',
'singular_name' => 'Book',
'menu_name' => 'Books',
'add_new' => 'Add Book',
'add_new_item' => 'Add New Book',
'edit' => 'Edit',
'edit_item' => 'Edit Book',
'new_item' => 'New Book',
'view' => 'View Book',
'view_item' => 'View Book',
'search_items' => 'Search Books',
'not_found' => 'No Books Found',
'not_found_in_trash' => 'No Books Found in Trash',
'parent' => 'Parent Book',
),) );
// Custom taxonomies that support books.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment