1. <?php
  2. function register_works() {
  3. // Set UI labels for Custom Post Type
  4. $labels = array(
  5. 'name' => _x( 'Works', 'Post Type General Name', 'twentyfifteen' ),
  6. 'singular_name' => _x( 'Work', 'Post Type Singular Name', 'twentyfifteen' ),
  7. 'menu_name' => __( 'Works', 'twentyfifteen' ),
  8. 'parent_item_colon' => __( 'Parent Work', 'twentyfifteen' ),
  9. 'all_items' => __( 'All Works', 'twentyfifteen' ),
  10. 'view_item' => __( 'View Work', 'twentyfifteen' ),
  11. 'add_new_item' => __( 'Add New Work', 'twentyfifteen' ),
  12. 'add_new' => __( 'Add New', 'twentyfifteen' ),
  13. 'edit_item' => __( 'Edit Work', 'twentyfifteen' ),
  14. 'update_item' => __( 'Update Work', 'twentyfifteen' ),
  15. 'search_items' => __( 'Search Work', 'twentyfifteen' ),
  16. 'not_found' => __( 'Not Found', 'twentyfifteen' ),
  17. 'not_found_in_trash' => __( 'Not found in Trash', 'twentyfifteen' ),
  18. );
  19. // Set other options for Custom Post Type
  20. $args = array(
  21. 'label' => __( 'works', 'twentyseventeen' ),
  22. 'description' => __( 'Work news and reviews', 'twentyseventeen' ),
  23. 'labels' => $labels,
  24. 'taxonomies' => array( 'category' ),
  25. 'hierarchical' => false,
  26. 'public' => true,
  27. 'show_ui' => true,
  28. 'show_in_menu' => true,
  29. 'show_in_nav_menus' => true,
  30. 'show_in_admin_bar' => true,
  31. 'menu_position' => 5,
  32. 'can_export' => true,
  33. 'has_archive' => true,
  34. 'exclude_from_search' => false,
  35. 'publicly_queryable' => true,
  36. 'capability_type' => 'page',
  37. );
  38. // Registering your Custom Post Type
  39. register_post_type( 'works', $args );
  40. }
  41. /* Hook into the 'init' action so that the function
  42. * Containing our post type registration is not
  43. * unnecessarily executed.
  44. */
  45. add_action( 'init', 'register_works');