Last active
January 8, 2020 18:18
-
-
Save DarioBF/d81749c10fb784f3ab6940a1abe93f2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'init', 'bf_register_custom_post_type' ); | |
/** | |
* Registro un custom post type 'libro'. | |
* | |
* @link http://codex.wordpress.org/Function_Reference/register_post_type | |
*/ | |
function bf_register_custom_post_type() { | |
/* Añado las etiquetas que aparecerán en el escritorio de WordPress */ | |
$labels = array( | |
'name' => _x( 'Libros', 'post type general name', 'text-domain' ), | |
'singular_name' => _x( 'Libro', 'post type singular name', 'text-domain' ), | |
'menu_name' => _x( 'Libros', 'admin menu', 'text-domain' ), | |
'add_new' => _x( 'Añadir nuevo', 'libro', 'text-domain' ), | |
'add_new_item' => __( 'Añadir nuevo libro', 'text-domain' ), | |
'new_item' => __( 'Nuevo libro', 'text-domain' ), | |
'edit_item' => __( 'Editar libro', 'text-domain' ), | |
'view_item' => __( 'Ver libro', 'text-domain' ), | |
'all_items' => __( 'Todos los libros', 'text-domain' ), | |
'search_items' => __( 'Buscar libros', 'text-domain' ), | |
'not_found' => __( 'No hay libros.', 'text-domain' ), | |
'not_found_in_trash' => __( 'No hay libros en la papelera.', 'text-domain' ) | |
); | |
/* Configuro el comportamiento y funcionalidades del nuevo custom post type */ | |
$args = array( | |
'labels' => $labels, | |
'description' => __( 'Descripción.', 'text-domain' ), | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'libro' ), | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => false, | |
'menu_position' => null, | |
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ) | |
); | |
register_post_type( 'libro', $args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment