RH Squad CPT
// Register Custom Post Type
function rh_squad_custom_post_type() {
$labels = array(
'name' => _x( 'Squads', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Squad', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Squads', 'text_domain' ),
'name_admin_bar' => __( 'Squad', 'text_domain' ),
'archives' => __( 'Squad Archives', 'text_domain' ),
'attributes' => __( 'Squad Attributes', 'text_domain' ),
'parent_item_colon' => __( 'Parent Squad', 'text_domain' ),
'all_items' => __( 'All Squads', 'text_domain' ),
'add_new_item' => __( 'Add New Squad', 'text_domain' ),
'add_new' => __( 'Add New Squad', 'text_domain' ),
'new_item' => __( 'New Squad', 'text_domain' ),
'edit_item' => __( 'Edit Squad', 'text_domain' ),
'update_item' => __( 'Update Squad', 'text_domain' ),
'view_item' => __( 'View Squad', 'text_domain' ),
'view_items' => __( 'View Squads', 'text_domain' ),
'search_items' => __( 'Search Squads', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
'featured_image' => __( 'Squad Image', 'text_domain' ),
'set_featured_image' => __( 'Set Squad Image', 'text_domain' ),
'remove_featured_image' => __( 'Remove Squad Image', 'text_domain' ),
'use_featured_image' => __( 'Use as Squage Image', 'text_domain' ),
'insert_into_item' => __( 'Insert into Squad', 'text_domain' ),
'uploaded_to_this_item' => __( 'Uploaded to this Squad', 'text_domain' ),
'items_list' => __( 'Squads list', 'text_domain' ),
'items_list_navigation' => __( 'Squads list navigation', 'text_domain' ),
'filter_items_list' => __( 'Filter items list', 'text_domain' ),
);
$capabilities = array(
'edit_post' => 'edit_squad',
'read_post' => 'read_squad',
'delete_post' => 'delete_squad',
'edit_posts' => 'edit_squads',
'edit_others_posts' => 'edit_others_squads',
'publish_posts' => 'publish_squads',
'read_private_posts' => 'read_private_squads',
);
$args = array(
'label' => __( 'Squad', 'text_domain' ),
'description' => __( 'Creates the Squad Custom Post Type', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'author', 'comments', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-businessman',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capabilities' => $capabilities,
'show_in_rest' => true,
);
register_post_type( 'squad', $args );
}
add_action( 'init', 'rh_squad_custom_post_type', 0 );