/ Published in: PHP

Code for the wordpress functions file to add a custom post type.
Full doc at:
http://codex.wordpress.org/Function_Reference/register_post_type
http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress
Full doc at:
http://codex.wordpress.org/Function_Reference/register_post_type
http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
add_action('init', 'my_custom_init'); function my_custom_init() { 'name' => _x('Books', 'post type general name'), 'singular_name' => _x('Book', 'post type singular name'), 'add_new' => _x('Add New', 'book'), 'add_new_item' => __('Add New Book'), 'edit_item' => __('Edit Book'), 'new_item' => __('New Book'), 'view_item' => __('View Book'), 'search_items' => __('Search Books'), 'not_found' => __('No books found'), 'not_found_in_trash' => __('No books found in Trash'), 'parent_item_colon' => '' ); 'labels' => $labels, 'public' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, ); register_post_type('book',$args); }
Comments
