Article Post Type Creation
// Register Custom Post Type
function create_app_post_type() {
$labels = array(
'name' => 'Applications',
'singular_name' => 'Application',
'menu_name' => 'Applications',
'name_admin_bar' => 'Application',
'archives' => 'Application Archives',
'attributes' => 'Application Attributes',
'parent_item_colon' => '',
'all_items' => 'All Applications',
'add_new_item' => 'Add New Application',
'add_new' => 'Add New',
'new_item' => 'New Application',
'edit_item' => 'Edit Application',
'update_item' => 'Update Application',
'view_item' => 'View Application',
'view_items' => 'View Applications',
'search_items' => 'Search Application',
'not_found' => 'Not found',
'not_found_in_trash' => 'Not found in Trash',
'featured_image' => 'Featured Image',
'set_featured_image' => 'Set featured image',
'remove_featured_image' => 'Remove featured image',
'use_featured_image' => 'Use as featured image',
'insert_into_item' => 'Insert into Application',
'uploaded_to_this_item' => 'Uploaded to this Application',
'items_list' => 'Applications list',
'items_list_navigation' => 'Applications list navigation',
'filter_items_list' => 'Filter Application list',
);
$capabilities = array(
'edit_post' => 'edit_application',
'read_post' => 'read_application',
'delete_post' => 'delete_application',
'edit_posts' => 'edit_applications',
'edit_others_posts' => 'edit_others_applications',
'publish_posts' => 'publish_applications',
'read_private_posts' => 'read_private_applications',
);
$args = array(
'label' => 'Application',
'description' => 'Corresponds to root node in a website.',
'labels' => $labels,
'supports' => array( 'title', 'thumbnail', 'comments', 'revisions', 'custom-fields', 'post-formats' ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-admin-site',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'query_var' => 'application',
'capabilities' => $capabilities,
'show_in_rest' => true,
'rest_controller_class' => 'WP_REST_Applications_Controller',
);
register_post_type( 'application', $args );
}
add_action( 'init', 'create_app_post_type', 0 );