By default WordPress have different post types. Please have a look below listed once.
- Post
- Page
- Attachment
- Revision
- Nav Menu
Instead above If you are going to add your own post type like movies, services and games n all then you can definitely possible to create own post types.
On our WordPress site, post types are used to recognizing different content types in WordPress. Posts and pages are both post types but they are made to serve different purposes.
Add below code into functions file (functions.php)
You can see at wordpress admin dashboard side post type created (left side sidebar) named as ‘Services’
// Set UI labels for Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Services', 'Post Type General Name', 'twentytwentyone' ),
'singular_name' => _x( 'Service', 'Post Type Singular Name', 'twentytwentyone' ),
'menu_name' => __( 'Services', 'twentytwentyone' ),
'parent_item_colon' => __( 'Parent Service', 'twentytwentyone' ),
'all_items' => __( 'All Services', 'twentytwentyone' ),
'view_item' => __( 'View Service', 'twentytwentyone' ),
'add_new_item' => __( 'Add New Service', 'twentytwentyone' ),
'add_new' => __( 'Add New', 'twentytwentyone' ),
'edit_item' => __( 'Edit Service', 'twentytwentyone' ),
'update_item' => __( 'Update Service', 'twentytwentyone' ),
'search_items' => __( 'Search Service', 'twentytwentyone' ),
'not_found' => __( 'Not Found', 'twentytwentyone' ),
'not_found_in_trash' => __( 'Not found in Trash', 'twentytwentyone' ),
);
// Set other options for Custom Post Type
$args = array(
'label' => __( 'services', 'twentytwentyone' ),
'description' => __( 'Service news and reviews', 'twentytwentyone' ),
'labels' => $labels,
// Features this CPT supports in Post Editor
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
// You can associate this CPT with a taxonomy or custom taxonomy.
'taxonomies' => array( 'genres' ),
/* A hierarchical CPT is like Pages and can have
* Parent and child items. A non-hierarchical CPT
* is like Posts.
*/
'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' => 'post',
'show_in_rest' => true,
);
// Registering your Custom Post Type
register_post_type( 'services', $args );
}
/* Hook into the 'init' action so that the function
* Containing our post type registration is not
* unnecessarily executed.
*/
add_action( 'init', 'custom_post_type', 0 );
Eduardo Goodman
Henley Murray