Advertisement
Guest User

Dogs CPT

a guest
Mar 25th, 2015
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.98 KB | None | 0 0
  1. // Register Custom Post Type
  2. function dogs_post_type() {
  3.  
  4.     $labels = array(
  5.         'name'                => _x( 'Dogs', 'Post Type General Name', 'adopt' ),
  6.         'singular_name'       => _x( 'Dog', 'Post Type Singular Name', 'adopt' ),
  7.         'menu_name'           => __( 'Dogs', 'adopt' ),
  8.         'parent_item_colon'   => __( 'Main Dog:', 'adopt' ),
  9.         'all_items'           => __( 'All Dogs', 'adopt' ),
  10.         'view_item'           => __( 'View Dog', 'adopt' ),
  11.         'add_new_item'        => __( 'Add New Dog', 'adopt' ),
  12.         'add_new'             => __( 'New Dog', 'adopt' ),
  13.         'new_item'            => _x( 'New Dog', 'adopt' ),
  14.         'edit_item'           => __( 'Edit Dog', 'adopt' ),
  15.         'update_item'         => __( 'Update Dog', 'adopt' ),
  16.         'search_items'        => __( 'Search Dogs', 'adopt' ),
  17.         'not_found'           => __( 'No Dogs found', 'adopt' ),
  18.         'not_found_in_trash'  => __( 'No Dogs found in Trash', 'adopt' ),
  19.     );
  20.     $args = array(
  21.         'label'               => __( 'dogs', 'adopt' ),
  22.         'description'         => __( 'To display dogs', 'adopt' ),
  23.         'labels'              => $labels,
  24.         'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
  25.         'taxonomies'          => array( 'breed','location', 'size-dogs', 'sexes-dogs' ),
  26.         'hierarchical'        => false,
  27.         'public'              => true,
  28.         'show_ui'             => true,
  29.         'show_in_menu'        => true,
  30.         'show_in_nav_menus'   => true,
  31.         'show_in_admin_bar'   => true,
  32.         'menu_position'       => 10,
  33.         'menu_icon'           => 'dashicons-admin-post',
  34.         'can_export'          => true,
  35.         'has_archive'         => true,
  36.         'exclude_from_search' => false,
  37.         'publicly_queryable'  => true,
  38.         'capability_type'     => 'post',
  39.         'query_var'           => false,
  40.         'rewrite'             => array("slug"=>"dogs"), //Permalinks format,
  41.         'register_meta_box_cb' => 'add_dogs_metaboxes'
  42.     );
  43.     register_post_type( 'dogs', $args );
  44.  
  45. }
  46.  
  47. // Hook into the 'init' action
  48. add_action( 'init', 'dogs_post_type', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement