Skip to content

Instantly share code, notes, and snippets.

@DavidPeralvarez
Created June 12, 2018 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidPeralvarez/a5e9e1e9671fbe18c70cd48429d150fd to your computer and use it in GitHub Desktop.
Save DavidPeralvarez/a5e9e1e9671fbe18c70cd48429d150fd to your computer and use it in GitHub Desktop.
La función register_post_type y los "labels"
<?php
/*
Plugin Name: Plugin CPT y Custom Taxonomies
Plugin URI: https://silicodevalley.com
Description: Plugin para aprender a crear CPT y CT con código
Version: 1.0.0
Author: David Perálvarez
Author URI: https://silicodevalley.com
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
/*
Plugin CPT y Custom Taxonomies is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
Plugin CPT y Custom Taxonomies is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Plugin CPT y Custom Taxonomies. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
*/
// Comic Reviews
function comic_review_setup_post_type(){
$labels = array(
'name' => __( 'Reseñas', 'scv' ),
'singular_name' => __( 'Reseña', 'scv' ),
'add_new' => __( 'Añadir reseña', 'scv' ),
'add_new_item' => __( 'Añadir nueva reseña', 'scv' ),
'edit_item' => __( 'Editar reseña', 'scv' ),
'new_item' => __( 'Nueva reseña', 'scv' ),
'view_item' => __( 'Ver reseña', 'scv' ),
'view_items' => __( 'Ver reseñas', 'scv' ),
'search_items' => __( 'Buscar reseñas', 'scv' ),
'not_found' => __( 'No se encontraron reseñas', 'scv' ),
'not_found_in_trash' => __( 'Ninguna reseña encontrada en la papelera', 'scv' ),
//'parent_item_colon'
'all_items' => __( 'Todas las reseñas', 'scv' ),
//'archives'
//'atributes'
'insert_into_item' => __( 'Insertar en la reseña', 'scv' ),
//'uploaded_to_this_item'
//'featured_image'
//'set_featured_image'
//'remove_featured_image'
//'use_featured_image'
//'menu_name' => __( 'Reseñas de cómics', 'scv' ),
'filter_items_list' => __( 'Lista de reseñas filtrada', 'scv' ),
'items_list_navigation' => __( 'Navegación por el listado de reseñas', 'scv' ),
'items_list' => __( 'Lista de reseñas', 'scv' ),
//'name_admin_bar'
);
$args = array(
'public' => true,
'labels' => $labels,
);
// poner prefijo, max 20
register_post_type( 'scv_comic_review', $args );
}
add_action( 'init', 'comic_review_setup_post_type' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment