Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

CPT Produkter

// Register Custom Post Type
function custom_post_produkter() {

	$labels = array(
		'name'                  => _x( 'Produkter', 'Post Type General Name', 'pxlbrk' ),
		'singular_name'         => _x( 'Produkt', 'Post Type Singular Name', 'pxlbrk' ),
		'menu_name'             => __( 'Produkter', 'pxlbrk' ),
		'name_admin_bar'        => __( 'Produkt', 'pxlbrk' ),
		'archives'              => __( 'Produktarkiv', 'pxlbrk' ),
		'attributes'            => __( 'Produktattribut', 'pxlbrk' ),
		'parent_item_colon'     => __( 'Överordnad produkt', 'pxlbrk' ),
		'all_items'             => __( 'Alla produkter', 'pxlbrk' ),
		'add_new_item'          => __( 'Lägg till ny produkt', 'pxlbrk' ),
		'add_new'               => __( 'Lägg till ny', 'pxlbrk' ),
		'new_item'              => __( 'Ny produkt', 'pxlbrk' ),
		'edit_item'             => __( 'Redigera produkt', 'pxlbrk' ),
		'update_item'           => __( 'Uppdatera produkt', 'pxlbrk' ),
		'view_item'             => __( 'Visa produkt', 'pxlbrk' ),
		'view_items'            => __( 'Visa produkter', 'pxlbrk' ),
		'search_items'          => __( 'Sök produkt', 'pxlbrk' ),
		'not_found'             => __( 'Hittades inte', 'pxlbrk' ),
		'not_found_in_trash'    => __( 'Hittades inte i papperskorgen', 'pxlbrk' ),
		'featured_image'        => __( 'Produktbild', 'pxlbrk' ),
		'set_featured_image'    => __( 'Välj produktbild', 'pxlbrk' ),
		'remove_featured_image' => __( 'Ta bort produktbild', 'pxlbrk' ),
		'use_featured_image'    => __( 'Använd som produktbild', 'pxlbrk' ),
		'insert_into_item'      => __( 'Infoga till produkt', 'pxlbrk' ),
		'uploaded_to_this_item' => __( 'Uppladdat till denna produkt', 'pxlbrk' ),
		'items_list'            => __( 'Produktlista', 'pxlbrk' ),
		'items_list_navigation' => __( 'Produktlista navigation', 'pxlbrk' ),
		'filter_items_list'     => __( 'Filtrera produktlista', 'pxlbrk' ),
	);
	$args = array(
		'label'                 => __( 'Produkt', 'pxlbrk' ),
		'description'           => __( 'Alla produkter och tillbehör', 'pxlbrk' ),
		'labels'                => $labels,
		'supports'              => array( ),
		'taxonomies'            => array( 'produktkategori' ),
		'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'       => 'page',
	);
	register_post_type( 'produkter', $args );

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