Error 404 in CPT

Posted in: Newspaper
Post count: 15

Hi,
I’m using a CPT for images with quotes. With two taxonomies, topics (as categories) and autor (as tags).
I’m using this code but I have a Error 404 when I click in a single quote or in page:

add_action( 'init', 'add_citas' );

function add_citas() {
$labels = array(
'name' => _x( 'Citas', 'post type general name' ),
'singular_name' => _x( 'Cita', 'post type singular name' ),
'add_new' => _x( 'Añadir nueva', 'book' ),
'add_new_item' => __( 'Añadir nueva cita' ),
'edit_item' => __( 'Editar Cita' ),
'new_item' => __( 'Nueva Cita' ),
'view_item' => __( 'Ver Cita' ),
'search_items' => __( 'Buscar Citas' ),
'not_found' => __( 'No se han encontrado Citas' ),
'not_found_in_trash' => __( 'No se han encontrado Citas en la papelera' ),
'parent_item_colon' => ''
);

$args = array( 'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_icon' => 'dashicons-format-image',
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
);

register_post_type( 'citas', $args ); /* Registramos y a funcionar */
}

add_action( 'init', 'create_citas_taxonomies', 0 );

function create_citas_taxonomies() {

$labels = array(
'name' => _x( 'Temáticas', 'taxonomy general name' ),
'singular_name' => _x( 'Temática', 'taxonomy singular name' ),
'search_items' => __( 'Buscar por temática' ),
'all_items' => __( 'Todas las temáticas' ),
'parent_item' => __( 'Temática padre' ),
'parent_item_colon' => __( 'Temática padre:' ),
'edit_item' => __( 'Editar temática' ),
'update_item' => __( 'Actualizar temática' ),
'add_new_item' => __( 'Añadir nueva temática' ),
'new_item_name' => __( 'Nombre de la nueva temática' ),
);
register_taxonomy( 'temática', array( 'citas' ), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'citas' ),
));

$labels = array(
'name' => _x( 'Autores', 'taxonomy general name' ),
'singular_name' => _x( 'Autor', 'taxonomy singular name' ),
'search_items' => __( 'Buscar autores' ),
'popular_items' => __( 'Autores populares' ),
'all_items' => __( 'Todos los autores' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Editar autor' ),
'update_item' => __( 'Actualizar autor' ),
'add_new_item' => __( 'Añadir nuevo autor' ),
'new_item_name' => __( 'Nombre del nuevo autor' ),
'separate_items_with_commas' => __( 'Separar autores por comas' ),
'add_or_remove_items' => __( 'Añadir o eliminar autores' ),
'choose_from_most_used' => __( 'Escoger entre los autores más utilizados' )
);

register_taxonomy( 'autor', 'citas', array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'escritor' ),
));
}

Could you help me? It has to be a silly thing…

Thanks!

Post count: 15

You can see it here:
– Web quotes (error 404): http://www.alaya.es/citas
– Categories: http://www.alaya.es/citas/frases-educacion/
– Single quote (error 404): http://www.alaya.es/citas/la-educacion-la-clave-oprah-winfrey/

🙁

Post count: 15

Solved.
I add in the code has_archive => true,
And I did a single-citas.php and archive-citas.php
To change the rules, I change the permalinks and save, and change them again to my permalink structure.
It’s working now!

Thanks

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newspaper’ is closed to new topics and replies.