This has been asked lots of times in stackoverflow but I'm doing everything and nothing works I still get "Oops! That page can’t be found."
I got a template where I loop the CPT taxonomies with the link []
When I click one of the categories I get the URL
http://comisionpais.com/categorias/educacion/
http://comisionpais.com/categorias/{taxonomy}
I got this files created
taxonomy-comision-publicaciones.php
taxonomy.php
category-publica.php
category.php
and this is the code for the 3 CPT I'm using
/****************** Custom Post Type ***************/
// Our custom post type function
function create_posttype() {
register_post_type( 'publica',
// CPT Options
array(
'labels' => array(
'name' => __( 'Publicaciones' ),
'singular_name' => __( 'Publicación' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'publicacion'),
// Features this CPT supports in Post Editor
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail' ),
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'menu_icon' => 'dashicons-book',
)
);
register_post_type( 'entrev',
// CPT Options
array(
'labels' => array(
'name' => __( 'Entrevistas' ),
'singular_name' => __( 'Entrevista' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'entrevista'),
// Features this CPT supports in Post Editor
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail' ),
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'menu_icon' => 'dashicons-video-alt3',
)
);
register_post_type( 'reco',
// CPT Options
array(
'labels' => array(
'name' => __( 'Reconocimientos' ),
'singular_name' => __( 'Reconocimiento' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'reconocimiento'),
// Features this CPT supports in Post Editor
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail' ),
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'menu_icon' => 'dashicons-awards',
)
);
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
/****** CPT Category Link ******/
function create_comision_taxonomies() {
$labels = array(
'name' => _x( 'Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Categories' ),
'all_items' => __( 'All Categories' ),
'parent_item' => __( 'Parent Category' ),
'parent_item_colon' => __( 'Parent Category:' ),
'edit_item' => __( 'Edit Category' ),
'update_item' => __( 'Update Category' ),
'add_new_item' => __( 'Add New Category' ),
'new_item_name' => __( 'New Category Name' ),
'menu_name' => __( 'Categories' ),
);
$args = array(
'hierarchical' => true, // Set this to 'false' for non-hierarchical taxonomy (like tags)
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'categorias' ),
);
register_taxonomy( 'comision-publicaciones', array( 'publica' ), $args );
register_taxonomy( 'comision-entrevistas', array( 'entrev' ), $args );
register_taxonomy( 'comision-reconocimientos', array( 'reco' ), $args );
}
add_action( 'init', 'create_comision_taxonomies', 0 );
So I'm concerned if I got wrong the naming of the files, but with all I've read if I use the main file name like taxonomy.php or category.php will use those files but nothing is happening.
array( 'slug' => 'categorias' )
. I think it is wrong – Zendah