Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

SA Product

// Register Custom Post Type
function sa_ctp_products() {

	$labels = array(
		'name'                  => _x( 'Produkter', 'Post Type General Name', 'sa' ),
		'singular_name'         => _x( 'Produkt', 'Post Type Singular Name', 'sa' ),
		'menu_name'             => __( 'Produkter', 'sa' ),
		'name_admin_bar'        => __( 'Produkt', 'sa' ),
		'archives'              => __( 'Produktarkiv', 'sa' ),
		'attributes'            => __( 'Produktegenskaper', 'sa' ),
		'parent_item_colon'     => __( 'Foreldreprodukt', 'sa' ),
		'all_items'             => __( 'Alle produkter', 'sa' ),
		'add_new_item'          => __( 'Legg til produkt', 'sa' ),
		'add_new'               => __( 'Legg til', 'sa' ),
		'new_item'              => __( 'Nytt produkt', 'sa' ),
		'edit_item'             => __( 'Rediger produkt', 'sa' ),
		'update_item'           => __( 'Oppdater produkt', 'sa' ),
		'view_item'             => __( 'Vis produkt', 'sa' ),
		'view_items'            => __( 'Vis produkter', 'sa' ),
		'search_items'          => __( 'Søk etter produkt', 'sa' ),
		'not_found'             => __( 'Ikke funnet', 'sa' ),
		'not_found_in_trash'    => __( 'Ikke funnet i papirkurven', 'sa' ),
		'featured_image'        => __( 'Fremhevet bilde', 'sa' ),
		'set_featured_image'    => __( 'Velg fremhevet bilde', 'sa' ),
		'remove_featured_image' => __( 'Fjern fremhevet bilde', 'sa' ),
		'use_featured_image'    => __( 'Bruk som fremhevet bilde', 'sa' ),
		'insert_into_item'      => __( 'Sett inn i product', 'sa' ),
		'uploaded_to_this_item' => __( 'Lastet opp til dette produktet', 'sa' ),
		'items_list'            => __( 'Produktliste', 'sa' ),
		'items_list_navigation' => __( 'Produktlistenavigasjon', 'sa' ),
		'filter_items_list'     => __( 'Filtrer produktliste', 'sa' ),
	);
	$rewrite = array(
		'slug'                  => 'produkt',
		'with_front'            => true,
		'pages'                 => true,
		'feeds'                 => true,
	);
	$args = array(
		'label'                 => __( 'Produkt', 'sa' ),
		'description'           => __( 'Produkter', 'sa' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'revisions', ),
		'taxonomies'            => array( 'sa_tax_product_groups', 'sa_tax_product_contact' ),
		'hierarchical'          => false,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => 'dashicons-cart',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => true,		
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'rewrite'               => $rewrite,
		'capability_type'       => 'post',
	);
	register_post_type( 'sa_cpt_product', $args );

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