Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Templates

if ( ! function_exists('template') ) {

// Register Custom Post Type
function template() {

	$labels = array(
		'name'                  => _x( 'Templates', 'Post Type General Name', 'anderson-lite' ),
		'singular_name'         => _x( 'Template', 'Post Type Singular Name', 'anderson-lite' ),
		'menu_name'             => __( 'Templates', 'anderson-lite' ),
		'name_admin_bar'        => __( 'Template', 'anderson-lite' ),
		'archives'              => __( 'Template archieven', 'anderson-lite' ),
		'parent_item_colon'     => __( 'Parent Item:', 'anderson-lite' ),
		'all_items'             => __( 'Alle templates', 'anderson-lite' ),
		'add_new_item'          => __( 'Voeg template toe', 'anderson-lite' ),
		'add_new'               => __( 'Voeg toe', 'anderson-lite' ),
		'new_item'              => __( 'Nieuw template', 'anderson-lite' ),
		'edit_item'             => __( 'Bewerk template', 'anderson-lite' ),
		'update_item'           => __( 'Update template', 'anderson-lite' ),
		'view_item'             => __( 'Bekijk template', 'anderson-lite' ),
		'search_items'          => __( 'Doorzoek templates', 'anderson-lite' ),
		'not_found'             => __( 'Niet gevonden', 'anderson-lite' ),
		'not_found_in_trash'    => __( 'Niets gevonden', 'anderson-lite' ),
		'featured_image'        => __( 'Featured Image', 'anderson-lite' ),
		'set_featured_image'    => __( 'Set featured image', 'anderson-lite' ),
		'remove_featured_image' => __( 'Remove featured image', 'anderson-lite' ),
		'use_featured_image'    => __( 'Use as featured image', 'anderson-lite' ),
		'insert_into_item'      => __( 'Voeg aan template toe', 'anderson-lite' ),
		'uploaded_to_this_item' => __( 'Geüpload naar dit template', 'anderson-lite' ),
		'items_list'            => __( 'Template lijst', 'anderson-lite' ),
		'items_list_navigation' => __( 'Template lijst navigatie', 'anderson-lite' ),
		'filter_items_list'     => __( 'Filter template lijst', 'anderson-lite' ),
	);
	$rewrite = array(
		'slug'                  => 'template',
		'with_front'            => true,
		'pages'                 => true,
		'feeds'                 => false,
	);
	$capabilities = array(
		'edit_post'             => 'edit_template',
		'read_post'             => 'read_template',
		'delete_post'           => 'delete_template',
		'edit_posts'            => 'edit_templates',
		'edit_others_posts'     => 'edit_others_templates',
		'publish_posts'         => 'publish_templates',
		'read_private_posts'    => 'read_private_templates',
	);
	$args = array(
		'label'                 => __( 'Template', 'anderson-lite' ),
		'description'           => __( 'HTML template die geladen kunnen worden via de plugin Custom Content Shortcode.', 'anderson-lite' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'revisions', ),
		'hierarchical'          => false,
		'public'                => false,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 60,
		'menu_icon'             => 'dashicons-editor-code',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => false,
		'can_export'            => true,
		'has_archive'           => false,		
		'exclude_from_search'   => true,
		'publicly_queryable'    => true,
		'rewrite'               => $rewrite,
		'capabilities'          => $capabilities,
	);
	register_post_type( 'template', $args );

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

}