How to Add Custom Post Type Section in WordPress without plugin.

CPT

CPT means custom post type. Add new separate custom post section in wordpress’s dashboard section. Design other’s section’s file like single-CPTNAME.php and archive-CPTNAME.php.

How To MAKE or Add CPT

Just follow simple steps and add CPT in your WordPress website-

>> Open Cpanel and go to theme’s function.php file.

>> then paste this code –

function register_hindipost() {

$labels = array(
'name' => 'Hindi Posts',
'singular_name' => 'Hindi Post',
'menu_name' => 'Hindi Posts',
'name_admin_bar' => 'Hindi Post',
'archives' => 'hindi-Archives',
'attributes' => 'Item Attributes',
'parent_item_colon' => 'Parent Item:',
'all_items' => 'All Items',
'add_new_item' => 'Add New Item',
'add_new' => 'Add New',
'new_item' => 'New Item',
'edit_item' => 'Edit Item',
'update_item' => 'Update Item',
'view_item' => 'View Item',
'view_items' => 'View Items',
'search_items' => 'Search Item',
'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 item',
'uploaded_to_this_item' => 'Uploaded to this item',
'items_list' => 'Items list',
'items_list_navigation' => 'Items list navigation',
'filter_items_list' => 'Filter items list',
);
$args = array(
'label' => 'Hindi post',
'description' => 'Post Type Description',
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'comments', ),
'taxonomies' => array( 'category' ),
'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' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
);
register_post_type( 'hindi', $args );
}
add_action( 'init', 'register_hindipost', 0 );

>> then SAVE function.php file.

>> Create some extra file for CPT. (single-CPTNAME.php and archive-CPTNAME.php.)

>> then go to wordpress dashboard and go to settings>permalink.

>> Set permalink to title name from custom structure and SAVE.

hope you understand how to create CPT section in WordPress website without using any plugins.