- <?php
- function register_works() {
- // Set UI labels for Custom Post Type
- $labels = array(
- 'name' => _x( 'Works', 'Post Type General Name', 'twentyfifteen' ),
- 'singular_name' => _x( 'Work', 'Post Type Singular Name', 'twentyfifteen' ),
- 'menu_name' => __( 'Works', 'twentyfifteen' ),
- 'parent_item_colon' => __( 'Parent Work', 'twentyfifteen' ),
- 'all_items' => __( 'All Works', 'twentyfifteen' ),
- 'view_item' => __( 'View Work', 'twentyfifteen' ),
- 'add_new_item' => __( 'Add New Work', 'twentyfifteen' ),
- 'add_new' => __( 'Add New', 'twentyfifteen' ),
- 'edit_item' => __( 'Edit Work', 'twentyfifteen' ),
- 'update_item' => __( 'Update Work', 'twentyfifteen' ),
- 'search_items' => __( 'Search Work', 'twentyfifteen' ),
- 'not_found' => __( 'Not Found', 'twentyfifteen' ),
- 'not_found_in_trash' => __( 'Not found in Trash', 'twentyfifteen' ),
- );
- // Set other options for Custom Post Type
- $args = array(
- 'label' => __( 'works', 'twentyseventeen' ),
- 'description' => __( 'Work news and reviews', 'twentyseventeen' ),
- 'labels' => $labels,
- 'taxonomies' => array( 'category' ),
- 'hierarchical' => false,
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'show_in_nav_menus' => true,
- 'show_in_admin_bar' => true,
- 'menu_position' => 5,
- 'can_export' => true,
- 'has_archive' => true,
- 'exclude_from_search' => false,
- 'publicly_queryable' => true,
- 'capability_type' => 'page',
- );
- // Registering your Custom Post Type
- register_post_type( 'works', $args );
- }
- /* Hook into the 'init' action so that the function
- * Containing our post type registration is not
- * unnecessarily executed.
- */
- add_action( 'init', 'register_works');