Advertisement
bedas

example post type

Jul 16th, 2015
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.14 KB | None | 0 0
  1. // Register Custom Post Type
  2. function schmidthaensch_post_type() {
  3.  
  4.     $labels = array(
  5.         'name'                => _x( 'products', 'Post Type General Name', 'schmidthaensch-theme' ),
  6.         'singular_name'       => _x( 'product', 'Post Type Singular Name', 'schmidthaensch-theme' ),
  7.         'menu_name'           => __( 'Products', 'schmidthaensch-theme' ),
  8.         'name_admin_bar'      => __( 'Products', 'schmidthaensch-theme' ),
  9.         'parent_item_colon'   => __( 'Parent Item:', 'schmidthaensch-theme' ),
  10.         'all_items'           => __( 'All Items', 'schmidthaensch-theme' ),
  11.         'add_new_item'        => __( 'Add New Item', 'schmidthaensch-theme' ),
  12.         'add_new'             => __( 'Add New', 'schmidthaensch-theme' ),
  13.         'new_item'            => __( 'New Item', 'schmidthaensch-theme' ),
  14.         'edit_item'           => __( 'Edit Item', 'schmidthaensch-theme' ),
  15.         'update_item'         => __( 'Update Item', 'schmidthaensch-theme' ),
  16.         'view_item'           => __( 'View Item', 'schmidthaensch-theme' ),
  17.         'search_items'        => __( 'Search Item', 'schmidthaensch-theme' ),
  18.         'not_found'           => __( 'Not found', 'schmidthaensch-theme' ),
  19.         'not_found_in_trash'  => __( 'Not found in Trash', 'schmidthaensch-theme' ),
  20.     );
  21.     $args = array(
  22.         'label'               => __( 'schmidthaensch_product', 'schmidthaensch-theme' ),
  23.         'description'         => __( 'Post Type Description', 'schmidthaensch-theme' ),
  24.         'labels'              => $labels,
  25.         'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ),
  26.         'hierarchical'        => false,
  27.         'public'              => true,
  28.         'show_ui'             => true,
  29.         'show_in_menu'        => true,
  30.         'menu_position'       => 5,
  31.         'show_in_admin_bar'   => true,
  32.         'show_in_nav_menus'   => true,
  33.         'can_export'          => true,
  34.         'has_archive'         => true,     
  35.         'exclude_from_search' => false,
  36.         'publicly_queryable'  => true,
  37.         'capability_type'     => 'page',
  38.     );
  39.     register_post_type( 'schmidthaensch_product', $args );
  40.  
  41. }
  42.  
  43. // Hook into the 'init' action
  44. add_action( 'init', 'schmidthaensch_post_type', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement