Custom Post Type Generator in WordPress
Default there are 5 custom post types in Wordpress which are posted, page, attachment, revision and nav_menu_item. In Wordpress you can create a more custom post type to using register post_type () function. There are multiple plugins in WordPress which are used to create custom post type, but here you can generate code to create custom post type and add that generated code to your an activated theme function.php file. No need to add plugin to create custom post type, more plugins which makes the wordpress website slow to load.
/*--------------------------- post type here--------------*/
add_action('init', '');
function () {
$labels = array( 'name' => _x( '', 'post type general name' ),
'singular_name' => _x( '', 'post type singular name' ),
'add_new' => _x( 'Add New', 'post' ),
'add_new_item' => __( 'Add New ' ),
'edit_item' => __( 'Edit ' ),
'new_item' => __( 'New ' ),
'all_items' => __( 'All ' ),
'view_item' => __( 'View ' ),
'search_items' => __( 'Search ' ),
'not_found' => __( 'No found' ),
'not_found_in_trash' => __( 'No found' ),
'parent_item_colon' => '',
'menu_name' => ''
);
$args = array(
'labels' => $labels,
'description' => ' posts',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'publicly_queryable' => true,
'menu_position' => 5,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true, 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
'menu_icon' => '',
);
register_post_type( '', $args );
register_taxonomy("", '', array("hierarchical" => true, "label" => " Category",'show_admin_column' => true, "singular_label" => "_page Category","rewrite" => true) );
}
add_action('init', '');
function () {
$labels = array( 'name' => _x( '', 'post type general name' ),
'singular_name' => _x( '', 'post type singular name' ),
'add_new' => _x( 'Add New', 'post' ),
'add_new_item' => __( 'Add New ' ),
'edit_item' => __( 'Edit ' ),
'new_item' => __( 'New ' ),
'all_items' => __( 'All ' ),
'view_item' => __( 'View ' ),
'search_items' => __( 'Search ' ),
'not_found' => __( 'No found' ),
'not_found_in_trash' => __( 'No found' ),
'parent_item_colon' => '',
'menu_name' => ''
);
$args = array(
'labels' => $labels,
'description' => ' posts',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'publicly_queryable' => true,
'menu_position' => 5,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true, 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
'menu_icon' => '',
);
register_post_type( '', $args );
register_taxonomy("", '', array("hierarchical" => true, "label" => " Category",'show_admin_column' => true, "singular_label" => "_page Category","rewrite" => true) );
}