Advertisement
Beee

register_post_type wheels

Dec 9th, 2013
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. // register post_type wheels
  2. function custom_post_init() {
  3.         $labels = array(
  4.       'name'                                => 'Wheels',
  5.             'singular_name'             => 'Wheel',
  6.             'add_new'                           => 'Add new wheel',
  7.             'add_new_item'              => 'Add new wheel',
  8.             'edit_item'                     => 'Edit wheel',
  9.             'new_item'                      => 'New wheel',
  10.             'all_items'                     => 'All wheels',
  11.             'view_item'                     => 'View wheel',
  12.             'search_items'              => 'Search wheels',
  13.             'not_found'                     => 'No wheels',
  14.             'not_found_in_trash'    => 'No wheels in trash',
  15.             'menu_name'                     => 'Wheel'
  16.     );
  17.     $args = array(
  18.       'labels'                              => $labels,
  19.             'public'                                => true,
  20.             'exclude_from_search'       => false,
  21.             'public_queryable'          => true,
  22.             'show_ui'                           => true,
  23.             'show_in_menu'                  => true,
  24.             // 'show_in_admin_bar'      => true,
  25.             // 'query_var'                      => true,
  26.             'rewrite'                           => array( 'slug' => 'wheels', 'feeds' => true ),
  27.             'capability_type'           => 'post',
  28.             'has_archive'                       => true,
  29.             'menu_position'                 => 30,
  30.             // 'menu_icon'                      => url,
  31.             // 'hierarchical'               => false,
  32.             'supports'                          => array('title', 'editor', 'author', 'thumbnail', 'custom-fields','comments'),
  33.             'taxonomies'                        => array('category','post_tag')
  34.     );
  35.     register_post_type( 'wheels', $args );
  36. }
  37. add_action( 'init', 'custom_post_init' );
  38.  
  39. function add_taxonomy_to_post_type() {
  40.     register_taxonomy_for_object_type('category', 'wheels');
  41.     register_taxonomy_for_object_type('post_tag', 'wheels');
  42. }
  43. add_action('init', 'add_taxonomy_to_post_type');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement