Generar CPT
Código para generar un CPT
if ( ! function_exists('troher_crear_cpt_servicios') ) { // Register Custom Post Type function troher_crear_cpt_servicios() { $labels = array( 'name' => _x( 'Servicios', 'Post Type General Name', 'troher_crear_cpt_servicios' ), 'singular_name' => _x( 'Servicio', 'Post Type Singular Name', 'troher_crear_cpt_servicios' ), 'menu_name' => __( 'Servicios', 'troher_crear_cpt_servicios' ), 'name_admin_bar' => __( 'Servicios', 'troher_crear_cpt_servicios' ), 'archives' => __( 'Archivos de Servicios', 'troher_crear_cpt_servicios' ), 'attributes' => __( 'Item Attributes', 'troher_crear_cpt_servicios' ), 'parent_item_colon' => __( 'Categoria Padre', 'troher_crear_cpt_servicios' ), 'all_items' => __( 'Todos los Servicios', 'troher_crear_cpt_servicios' ), 'add_new_item' => __( 'Añadir Nuevo Servicio', 'troher_crear_cpt_servicios' ), 'add_new' => __( 'Añadir Nuevo', 'troher_crear_cpt_servicios' ), 'new_item' => __( 'Nuevo Servicio', 'troher_crear_cpt_servicios' ), 'edit_item' => __( 'Editar Servicio', 'troher_crear_cpt_servicios' ), 'update_item' => __( 'Subir Servicio', 'troher_crear_cpt_servicios' ), 'view_item' => __( 'Ver Servicio', 'troher_crear_cpt_servicios' ), 'view_items' => __( 'Ver Servicios', 'troher_crear_cpt_servicios' ), 'search_items' => __( 'Buscar Servicio', 'troher_crear_cpt_servicios' ), 'not_found' => __( 'Not found', 'troher_crear_cpt_servicios' ), 'not_found_in_trash' => __( 'Not found in Trash', 'troher_crear_cpt_servicios' ), 'featured_image' => __( 'Featured Image', 'troher_crear_cpt_servicios' ), 'set_featured_image' => __( 'Set featured image', 'troher_crear_cpt_servicios' ), 'remove_featured_image' => __( 'Remove featured image', 'troher_crear_cpt_servicios' ), 'use_featured_image' => __( 'Use as featured image', 'troher_crear_cpt_servicios' ), 'insert_into_item' => __( 'Insert into item', 'troher_crear_cpt_servicios' ), 'uploaded_to_this_item' => __( 'Uploaded to this item', 'troher_crear_cpt_servicios' ), 'items_list' => __( 'Items list', 'troher_crear_cpt_servicios' ), 'items_list_navigation' => __( 'Items list navigation', 'troher_crear_cpt_servicios' ), 'filter_items_list' => __( 'Filter items list', 'troher_crear_cpt_servicios' ), ); $rewrite = array( 'slug' => 'servicios', 'with_front' => true, 'pages' => true, 'feeds' => true, ); $args = array( 'label' => __( 'Servicio', 'troher_crear_cpt_servicios' ), 'description' => __( 'CPT de Servicios', 'troher_crear_cpt_servicios' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-clipboard', '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( 'troher_servicios', $args ); } add_action( 'init', 'troher_crear_cpt_servicios', 0 ); }