• I’ve created a custom post type but it doesn’t appear listed. The CPT is properly created, I can even access them trough the REST API. What could be going wrong?

Viewing 1 replies (of 1 total)
  • Thread Starter Animalejourbano

    (@animalejourbano)

    This is how I’ve created the post type “Indicacion” and the custom taxonomy “Tipo”. May be there is something wrong or I’m missing something.

    // Register Custom Post Type
     function indicacion() {
    
     	$labels = array(
     		'name'                  => _x( 'Indicaciones', 'Post Type General Name', 'text_domain' ),
     		'singular_name'         => _x( 'Indicacion', 'Post Type Singular Name', 'text_domain' ),
     		'menu_name'             => __( 'Indicaciones', 'text_domain' ),
     		'name_admin_bar'        => __( 'Indicacion', 'text_domain' ),
     		'archives'              => __( 'Archivo de Indicaciones', 'text_domain' ),
     		'attributes'            => __( 'Atributos', 'text_domain' ),
     		'parent_item_colon'     => __( 'Indicacion relacionada', 'text_domain' ),
     		'all_items'             => __( 'Ver todas', 'text_domain' ),
     		'add_new_item'          => __( 'Agregar Indicacion', 'text_domain' ),
     		'add_new'               => __( 'Agregar', 'text_domain' ),
     		'new_item'              => __( 'Nueva', 'text_domain' ),
     		'edit_item'             => __( 'Editar', 'text_domain' ),
     		'update_item'           => __( 'Actualizar', 'text_domain' ),
     		'view_item'             => __( 'Ver', 'text_domain' ),
     		'view_items'            => __( 'Ver Indicaciones', 'text_domain' ),
     		'search_items'          => __( 'Buscar', 'text_domain' ),
     		'not_found'             => __( 'Sin resultados', 'text_domain' ),
     		'not_found_in_trash'    => __( 'Sin resultados en papeleras', 'text_domain' ),
     		'featured_image'        => __( 'Imagen Principal', 'text_domain' ),
     		'set_featured_image'    => __( 'Establecer imagen principal', 'text_domain' ),
     		'remove_featured_image' => __( 'Remover imagen principal', 'text_domain' ),
     		'use_featured_image'    => __( 'Usar como imagen principal', 'text_domain' ),
     		'insert_into_item'      => __( 'Insertar en Indicacion', 'text_domain' ),
     		'uploaded_to_this_item' => __( 'Subidos a esta Indicacion', 'text_domain' ),
     		'items_list'            => __( 'Listado de indicaciones', 'text_domain' ),
     		'items_list_navigation' => __( 'Navegacion de listado de indicaciones', 'text_domain' ),
     		'filter_items_list'     => __( 'Filtrar listado de indicaciones', 'text_domain' ),
     	);
     	$args = array(
     		'label'                 => __( 'Indicacion', 'text_domain' ),
     		'description'           => __( 'Indicaciones para Analisis', 'text_domain' ),
     		'labels'                => $labels,
     		'supports'              => array( 'title', 'editor', 'thumbnail' ),
     		'taxonomies'            => array( 'tipo' ),
     		'hierarchical'          => false,
     		'public'                => true,
     		'show_ui'               => true,
     		'show_in_menu'          => true,
     		'menu_position'         => 5,
     		'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',
     		'show_in_rest'          => true,
     		'rest_base'             => 'indicaciones',
     	);
     	register_post_type( 'indicacion', $args );
    
     }
     add_action( 'init', 'indicacion', 0 );
    
     function tipo() {
    
    	$labels = array(
    		'name'                       => _x( 'Tipos de Indicaciones', 'Taxonomy General Name', 'text_domain' ),
    		'singular_name'              => _x( 'Tipo de Indicación', 'Taxonomy Singular Name', 'text_domain' ),
    		'menu_name'                  => __( 'Tipos de Indicaciones', 'text_domain' ),
    		'all_items'                  => __( 'Todos los tipos', 'text_domain' ),
    		'parent_item'                => __( 'Tipo ancestro', 'text_domain' ),
    		'parent_item_colon'          => __( 'Tipo:', 'text_domain' ),
    		'new_item_name'              => __( 'Nuevo nombre de tipo', 'text_domain' ),
    		'add_new_item'               => __( 'Nuevo', 'text_domain' ),
    		'edit_item'                  => __( 'Editar', 'text_domain' ),
    		'update_item'                => __( 'Actualizar', 'text_domain' ),
    		'view_item'                  => __( 'Ver', 'text_domain' ),
    		'separate_items_with_commas' => __( 'Separar items con comas', 'text_domain' ),
    		'add_or_remove_items'        => __( 'Agregar o eliminar tipos', 'text_domain' ),
    		'choose_from_most_used'      => __( 'Elegir de los más usados', 'text_domain' ),
    		'popular_items'              => __( 'Tipos populares', 'text_domain' ),
    		'search_items'               => __( 'Buscar tipos', 'text_domain' ),
    		'not_found'                  => __( 'Sin resultados', 'text_domain' ),
    		'no_terms'                   => __( 'Si tipos', 'text_domain' ),
    		'items_list'                 => __( 'Listado de tipos', 'text_domain' ),
    		'items_list_navigation'      => __( 'Navegación de listado de tipos', 'text_domain' ),
    	);
    	$args = array(
    		'labels'                     => $labels,
    		'hierarchical'               => false,
    		'public'                     => true,
    		'show_ui'                    => true,
    		'show_admin_column'          => true,
    		'show_in_nav_menus'          => true,
    		'show_tagcloud'              => true,
    		'show_in_rest'               => true,
    	);
    	register_taxonomy( 'tipo', array( 'indicacion' ), $args );
    
    }
    add_action( 'init', 'tipo', 0 );
    
Viewing 1 replies (of 1 total)
  • The topic ‘My CPT Not listed’ is closed to new replies.