Created
January 18, 2018 08:45
-
-
Save perezdans/e133ea681cab5e1319249074acc8cd28 to your computer and use it in GitHub Desktop.
Código para meter en el functions.php o en un plugin para crear un custom post type de clientes para tu web de WordPress
This file contains hidden or 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
<?php | |
if ( ! function_exists('clientes_post_type') ) { | |
// Register Custom Post Type | |
function clientes_post_type() { | |
$labels = array( | |
'name' => 'Clientes', | |
'singular_name' => 'Cliente', | |
'menu_name' => 'Clientes', | |
'name_admin_bar' => 'Clientes', | |
'archives' => 'Archivo de clientes', | |
'attributes' => 'Atributos de cliente', | |
'parent_item_colon' => 'Cliente padre:', | |
'all_items' => 'Todos los clientes', | |
'add_new_item' => 'Nuevo cliente', | |
'add_new' => 'Añadir nuevo', | |
'new_item' => 'Nuevo cliente', | |
'edit_item' => 'Editar cliente', | |
'update_item' => 'Actualizar cliente', | |
'view_item' => 'Ver cliente', | |
'view_items' => 'Ver clientes', | |
'search_items' => 'Buscar cliente', | |
'not_found' => 'No encontrado', | |
'not_found_in_trash' => 'No encontrado en la papelera', | |
'featured_image' => 'Imagen destacada', | |
'set_featured_image' => 'Asignar imagen destacada', | |
'remove_featured_image' => 'Eliminar imagen destacada', | |
'use_featured_image' => 'Usar como imagen destacada', | |
'insert_into_item' => 'Insertar en cliente', | |
'uploaded_to_this_item' => 'Subido al cliente', | |
'items_list' => 'Lista de clientes', | |
'items_list_navigation' => 'Navegación por la lista de clientes', | |
'filter_items_list' => 'Filtrar la lista de clientes', | |
); | |
$args = array( | |
'label' => 'Cliente', | |
'description' => 'Lista de mis clientes', | |
'labels' => $labels, | |
'supports' => array( 'title', 'editor', 'thumbnail' ), | |
'taxonomies' => array( 'category', 'post_tag' ), | |
'hierarchical' => false, | |
'public' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'menu_position' => 5, | |
'menu_icon' => 'dashicons-universal-access', | |
'show_in_admin_bar' => true, | |
'show_in_nav_menus' => true, | |
'can_export' => true, | |
'has_archive' => true, | |
'exclude_from_search' => false, | |
'publicly_queryable' => true, | |
'capability_type' => 'page', | |
); | |
register_post_type( 'clientes', $args ); | |
} | |
add_action( 'init', 'clientes_post_type', 0 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment