Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Post Type Generator

if ( ! function_exists('competition') ) {

// Register Custom Post Type
function competition() {

	$labels = array(
		'name'                => 'Competitions',
		'singular_name'       => 'Competition',
		'menu_name'           => 'Competition',
		'name_admin_bar'      => 'Competition',
		'parent_item_colon'   => '',
		'all_items'           => 'All Competitions',
		'add_new_item'        => 'Add Competition',
		'add_new'             => 'Add New Competition',
		'new_item'            => 'New Competition',
		'edit_item'           => 'Edit Competition',
		'update_item'         => 'Update Competition',
		'view_item'           => 'View Competition',
		'search_items'        => 'Search Competition',
		'not_found'           => 'Not found',
		'not_found_in_trash'  => 'Not found in Trash',
	);
	$args = array(
		'label'               => 'competition',
		'labels'              => $labels,
		'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ),
		'taxonomies'          => array( 'category', 'post_tag' ),
		'hierarchical'        => false,
		'public'              => true,
		'show_ui'             => true,
		'show_in_menu'        => true,
		'menu_position'       => 10,
		'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'     => 'page',
	);
	register_post_type( 'competition', $args );

}

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

}