Custom Post Type: Dogs
if ( ! function_exists('dogs') ) {
// Register Custom Post Type
function dogs() {
$labels = array(
'name' => 'Dogs',
'singular_name' => 'Dog',
'menu_name' => 'Dogs',
'name_admin_bar' => 'Dog',
'archives' => 'Dog Archives',
'attributes' => 'Dog Attributes',
'parent_item_colon' => '',
'all_items' => 'All Dogs',
'add_new_item' => 'Add New Dog',
'add_new' => 'Add New',
'new_item' => 'New Dog',
'edit_item' => 'Edit Dog',
'update_item' => 'Update Dog',
'view_item' => 'View Dog',
'view_items' => 'View Dogs',
'search_items' => 'Search Dog',
'not_found' => 'Not found',
'not_found_in_trash' => 'Not found in Trash',
'featured_image' => '',
'set_featured_image' => '',
'remove_featured_image' => '',
'use_featured_image' => '',
'insert_into_item' => 'Insert into dog',
'uploaded_to_this_item' => 'Uploaded to this dog',
'items_list' => 'Dogs list',
'items_list_navigation' => 'Dogs list navigation',
'filter_items_list' => 'Filter dogs list',
);
$args = array(
'label' => 'Dog',
'description' => 'Dog bio page',
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ),
'taxonomies' => array( 'breed' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'show_in_rest' => true,
'rest_controller_class' => 'WP_REST_Dogs_Controller',
);
register_post_type( 'dogs', $args );
}
add_action( 'init', 'dogs', 0 );
}