Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

peliculas

CPT creado a partir del curso Avanzado de WordPress de Gonzalo Navarro

if ( ! function_exists('tk_peliculas') ) {

// Register Custom Post Type
function tk_peliculas() {

	$labels = array(
		'name'                  => _x( 'Peliculas', 'Post Type General Name', 'tk_peliculas' ),
		'singular_name'         => _x( 'Pelicula', 'Post Type Singular Name', 'tk_peliculas' ),
		'menu_name'             => __( 'Películas', 'tk_peliculas' ),
		'name_admin_bar'        => __( 'Películas', 'tk_peliculas' ),
		'archives'              => __( 'Archivo Películas', 'tk_peliculas' ),
		'attributes'            => __( 'Atributo Películas', 'tk_peliculas' ),
		'parent_item_colon'     => __( 'Películas padre:', 'tk_peliculas' ),
		'all_items'             => __( 'Todas las Películas', 'tk_peliculas' ),
		'add_new_item'          => __( 'Añadir nueva Película', 'tk_peliculas' ),
		'add_new'               => __( 'Añadir Película', 'tk_peliculas' ),
		'new_item'              => __( 'Nueva Película', 'tk_peliculas' ),
		'edit_item'             => __( 'Editar Película', 'tk_peliculas' ),
		'update_item'           => __( 'Actualizar Película', 'tk_peliculas' ),
		'view_item'             => __( 'Ver Película', 'tk_peliculas' ),
		'view_items'            => __( 'Ver Películas', 'tk_peliculas' ),
		'search_items'          => __( 'Buscar Película', 'tk_peliculas' ),
		'not_found'             => __( 'No encontrada', 'tk_peliculas' ),
		'not_found_in_trash'    => __( 'No encontrada en la Papelera', 'tk_peliculas' ),
		'featured_image'        => __( 'Imagen destacada', 'tk_peliculas' ),
		'set_featured_image'    => __( 'Asignar imagen destacada', 'tk_peliculas' ),
		'remove_featured_image' => __( 'Quitar imagen destacada', 'tk_peliculas' ),
		'use_featured_image'    => __( 'Usar como imagen destacada', 'tk_peliculas' ),
		'insert_into_item'      => __( 'Insertar en Película', 'tk_peliculas' ),
		'uploaded_to_this_item' => __( 'Subido a esta Película', 'tk_peliculas' ),
		'items_list'            => __( 'Lista de Películas', 'tk_peliculas' ),
		'items_list_navigation' => __( 'Lista de navegación de Películas', 'tk_peliculas' ),
		'filter_items_list'     => __( 'Filtrar lista de Películas', 'tk_peliculas' ),
	);
	$rewrite = array(
		'slug'                  => 'peliculas',
		'with_front'            => true,
		'pages'                 => true,
		'feeds'                 => true,
	);
	$args = array(
		'label'                 => __( 'Pelicula', 'tk_peliculas' ),
		'description'           => __( 'Crear contenido de películas', 'tk_peliculas' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'revisions', 'custom-fields', 'page-attributes' ),
		'taxonomies'            => array( 'category' ),
		'hierarchical'          => true,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'             => 'dashicons-editor-video',
		'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'       => 'page',
	);
	register_post_type( 'peliculas', $args );

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

}