Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Blog

// Register Custom Post Type
function rub_create_blog_post_type() {

	$labels = array(
		'name'                  => _x( 'Blog Posts', 'Post Type General Name', 'rub' ),
		'singular_name'         => _x( 'Blog Post', 'Post Type Singular Name', 'rub' ),
		'menu_name'             => __( 'Blog', 'rub' ),
		'name_admin_bar'        => __( 'Blog', 'rub' ),
		'parent_item_colon'     => __( 'Parent Post:', 'rub' ),
		'all_items'             => __( 'All Posts', 'rub' ),
		'add_new_item'          => __( 'Add New Post', 'rub' ),
		'add_new'               => __( 'Add New', 'rub' ),
		'new_item'              => __( 'New Post', 'rub' ),
		'edit_item'             => __( 'Edit Post', 'rub' ),
		'update_item'           => __( 'Update Post', 'rub' ),
		'view_item'             => __( 'View Post', 'rub' ),
		'search_items'          => __( 'Search Post', 'rub' ),
		'not_found'             => __( 'Not found', 'rub' ),
		'not_found_in_trash'    => __( 'Not found in Trash', 'rub' ),
		'items_list'            => __( 'Posts list', 'rub' ),
		'items_list_navigation' => __( 'Posts list navigation', 'rub' ),
		'filter_items_list'     => __( 'Filter posts list', 'rub' ),
	);
	$args = array(
		'label'                 => __( 'Blog Post', 'rub' ),
		'description'           => __( 'Blog Posts', 'rub' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'author', 'thumbnail', 'comments', ),
		'hierarchical'          => false,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => 'dashicons-edit',
		'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',
	);
	register_post_type( 'blogpost', $args );

}
add_action( 'init', 'rub_create_blog_post_type', 0 );