Advertisement
Beee

register post type wheels

Sep 21st, 2014
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.07 KB | None | 0 0
  1. function custom_post_init() {
  2.         // register post_type wheels
  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'                     => __( 'Wheels' )
  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.             // 'query_var'                      => 'wheels',
  25.             'rewrite'                               => array( 'slug' => 'wheels', 'feeds' => true ),
  26.             'has_archive'                       => true,
  27.             'menu_position'                 => 30,
  28.             'menu_icon'                         => get_stylesheet_directory_uri() . '/assets/img/cpt-wheel-icon.jpg',
  29.             // 'capability_type'            => 'wheel',
  30.             'capabilities'                  => array(
  31.                     'publish_posts'                 => 'publish_wheels',
  32.                     'edit_posts'                        => 'edit_wheels',
  33.                     'edit_others_posts'         => 'edit_others_wheels',
  34.                     'delete_posts'                  => 'delete_wheels',
  35.                     'delete_others_posts'   => 'delete_others_wheels',
  36.                     'read_private_posts'        => 'read_private_wheels',
  37.                     'edit_post'                         => 'edit_wheel',
  38.                     'delete_post'                   => 'delete_wheel',
  39.                     'read_post'                         => 'read_wheel'
  40.             ),
  41.             // 'hierarchical'               => false,
  42.             'supports'                          => array('title', 'editor', 'author', 'thumbnail', 'custom-fields','comments'),
  43.             'taxonomies'                        => array('category','post_tag')
  44.     );
  45.     register_post_type( 'wheels', $args );
  46. }
  47. add_action( 'init', 'custom_post_init' );
  48.  
  49. function add_taxonomy_to_post_type() {
  50.     register_taxonomy_for_object_type('category', 'wheels');
  51.     register_taxonomy_for_object_type('post_tag', 'wheels');
  52. }
  53. add_action('init', 'add_taxonomy_to_post_type');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement