Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Reviews Post Type

Reviews post type

// Register Custom Post Type
function reviews() {

	$labels = array(
		'name'                => _x( 'Reviews', 'Post Type General Name', 'reviews' ),
		'singular_name'       => _x( 'Review', 'Post Type Singular Name', 'reviews' ),
		'menu_name'           => __( 'Review', 'reviews' ),
		'parent_item_colon'   => __( 'Parent Review:', 'reviews' ),
		'all_items'           => __( 'All Reviews', 'reviews' ),
		'view_item'           => __( 'View Review', 'reviews' ),
		'add_new_item'        => __( 'Add New Review', 'reviews' ),
		'add_new'             => __( 'Add Review', 'reviews' ),
		'edit_item'           => __( 'Edit Review', 'reviews' ),
		'update_item'         => __( 'Update Review', 'reviews' ),
		'search_items'        => __( 'Search Review', 'reviews' ),
		'not_found'           => __( 'No reviews found', 'reviews' ),
		'not_found_in_trash'  => __( 'Not reviews found in Trash', 'reviews' ),
	);
	$rewrite = array(
		'slug'                => 'reviews',
		'with_front'          => true,
		'pages'               => true,
		'feeds'               => true,
	);
	$args = array(
		'label'               => __( 'reviews', 'reviews' ),
		'description'         => __( 'Product Reviews post type', 'reviews' ),
		'labels'              => $labels,
		'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', ),
		'taxonomies'          => array( 'category', 'post_tag' ),
		'hierarchical'        => true,
		'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,
		'query_var'           => 'reviews',
		'rewrite'             => $rewrite,
		'capability_type'     => 'page',
	);
	register_post_type( 'reviews', $args );

}

// Hook into the 'init' action
add_action( 'init', 'reviews', 0 );