Bonjour à tous,
Je sollicite votre aide pour un problème auquel je ne trouve pas de solution... J'ai créer un custom post_type pour faire des communiqués dans mon site. Tout s'affiche bien, aucun problème pour enregistré ou autre mais les permaliens entre en conflit !
Ce que je veux c'est : http://monsite.com/le-nom-de-ma-page/ (/%postname%/)
Et si je mets ça, il ne veut pas m'afficher mon communiqué... il me met erreur " We apologize but this page, post or resource does not exist or can not be found. Perhaps it is necessary to change the call method to this page, post or resource".
Par contre, si je mets par défaut les permaliens de Wordpress (www.monsite.com?p=15), il accepte de me l'affiché avec l'url ?communiques=mon-communique.
Voici le code de mon custom_post_type :
<?php
add_action( 'init', 'register_communiques' );
function register_communiques() {
$labels = array(
'name' => 'Communiqués',
'singular_name' => 'Communiqué',
'menu_name' => 'Communiqués',
'name_admin_bar' => 'Communiqués',
'add_new' => 'Ajouter un communiqué',
'add_new_item' => 'Ajouter un nouveau communiqué',
'new_item' => __( 'Nouveau communiqué', 'your-plugin-textdomain' ),
'edit_item' => __( 'Éditer un communiqué', 'your-plugin-textdomain' ),
'view_item' => __( 'Voir le communiqué', 'your-plugin-textdomain' ),
'all_items' => __( 'Tous les communiqués', 'your-plugin-textdomain' ),
'search_items' => __( 'Rechercher un communiqué', 'your-plugin-textdomain' ),
'parent_item_colon' => __( 'Communiqué(s) parent :', 'your-plugin-textdomain' ),
'not_found' => __( 'Aucun communiqué', 'your-plugin-textdomain' ),
'not_found_in_trash' => __( 'Aucun communiqué dans la corbeille', 'your-plugin-textdomain' )
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'communiques' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail')
);
register_post_type( 'communiques', $args );
}
?>
Qu'est-ce que je dois faire pour que les permaliens fonctionnent comme il faut ? Avec le nom de la page et pas son ID...
Merci !