/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Register Custom Post Type // snippet updated 6/3/2011 // Bare Bones // -- from Ian Stewart at bit.ly/wppoweredby function powered_by_create_post_type() { 'public' => true, ) ); } add_action( 'init', 'powered_by_create_post_type' ); // Basic and Quick // -- from Konstantin Kovshenin at bit.ly/kovcpt // -- also see Justin Tadlock at bit.ly/jtadcpt // -- and Custom Post Type Generator at bit.ly/generate-wpcpt // Fire this during init 'label' => __('Foos'), 'singular_label' => __('Foo'), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, )); // Full and Comprehensive // -- generated with the Custom Post Type Generator at bit.ly/generate-wpcpt add_action( 'init', 'register_cpt_foo' ); function register_cpt_foo() { 'name' => _x( 'Foos', 'foo' ), 'singular_name' => _x( 'foo', 'foo' ), 'add_new' => _x( 'Add New', 'foo' ), 'add_new_item' => _x( 'Add New foo', 'foo' ), 'edit_item' => _x( 'Edit foo', 'foo' ), 'new_item' => _x( 'New foo', 'foo' ), 'view_item' => _x( 'View foo', 'foo' ), 'search_items' => _x( 'Search Foos', 'foo' ), 'not_found' => _x( 'No foos found', 'foo' ), 'not_found_in_trash' => _x( 'No foos found in Trash', 'foo' ), 'parent_item_colon' => _x( 'Parent foo:', 'foo' ), 'menu_name' => _x( 'Foos', 'foo' ), ); 'labels' => $labels, 'hierarchical' => true, 'description' => 'These are foos.', 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'post' ); register_post_type( 'foo', $args ); } // end
URL: http://bit.ly/kovcpt