Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

CPT TEXT EXPANDER.

if ( ! function_exists('peter_crear_cpt_%filltext:name=ID_DEL_CPT%') ) {

// Register Custom Post Type
function peter_crear_cpt_%filltext:name=ID_DEL_CPT%() {

	$labels = array(
		'name'                  => _x( '%filltext:name=Plural del CPT%', 'Post Type General Name', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'singular_name'         => _x( '%filltext:name=Singular del CPT%', 'Post Type Singular Name', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'menu_name'             => __( '%filltext:name=Plural del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'name_admin_bar'        => __( '%filltext:name=Plural del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'archives'              => __( '%filltext:name=Singular del CPT% Archives', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'attributes'            => __( '%filltext:name=Singular del CPT% Attributes', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'parent_item_colon'     => __( 'Parent Item:', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'all_items'             => __( 'All %filltext:name=Plural del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'add_new_item'          => __( 'Add new %filltext:name=Singular del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'add_new'               => __( 'Add new %filltext:name=Singular del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'new_item'              => __( 'New %filltext:name=Singular del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'edit_item'             => __( 'Edit %filltext:name=Singular del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'update_item'           => __( 'Update %filltext:name=Singular del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'view_item'             => __( 'View %filltext:name=Singular del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'view_items'            => __( 'View %filltext:name=Plural del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'search_items'          => __( 'Search %filltext:name=Singular del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'not_found'             => __( 'Not found', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'not_found_in_trash'    => __( 'Not found in Trash', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'featured_image'        => __( 'Featured Image', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'set_featured_image'    => __( 'Set featured image', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'remove_featured_image' => __( 'Remove featured image', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'use_featured_image'    => __( 'Use as featured image', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'insert_into_item'      => __( 'Insert into %filltext:name=Singular del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'uploaded_to_this_item' => __( 'Uploaded to this %filltext:name=Singular del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'items_list'            => __( '%filltext:name=Plural del CPT% list', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'items_list_navigation' => __( '%filltext:name=Plural del CPT% list navigation', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'filter_items_list'     => __( 'Filter %filltext:name=Plural del CPT% list', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
	);
	$rewrite = array(
		'slug'                  => '%filltext:name=ID_DEL_CPT%',
		'with_front'            => true,
		'pages'                 => true,
		'feeds'                 => true,
	);
	$args = array(
		'label'                 => __( '%filltext:name=Singular del CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'description'           => __( 'CPT for %filltext:name=ID DEL CPT%', 'boluda_crear_cpt_%filltext:name=ID DEL CPT%' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions', ),
		'taxonomies'            => array( 'category' ),
		'hierarchical'          => false,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => '%filltext:name=Dash ICON%',
		'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( 'peter_%filltext:name', $args );

}
add_action( 'init', 'peter_crear_cpt_%filltext:name=ID_DEL_CPT%', 0 );

}