Wp Pagenavi and custom post type problem
-
Hi,
I’ve a problem to display Wp Pagenavi with my custom post type, it’s doesn’t work -> 404 error page.
Definition of my custom post type :
$labelsExposition = array( 'name' => _x('Expositions', 'post type general name'), 'singular_name' => _x('Exposition', 'post type singular name'), 'add_new' => _x('Ajouter une exposition', 'photo'), 'add_new_item' => __('Ajouter une exposition'), 'edit_item' => __('Editer une exposition'), 'new_item' => __('Nouvelle exposition'), 'view_item' => __('Voir l\'exposuition'), 'search_items' => __('Chercher une exposition'), 'not_found' => __('Aucunes expositions trouvées'), 'parent_item_colon' => '', 'menu_name' => 'Expositions' ); $argsExpositions = array( 'labels' => $labelsExposition, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'supports' => array('editor','thumbnail','title') ); register_post_type('exposition',$argsExpositions);
Permalink structure :
/%category%/%postname%.html
In my category-expositions.php file :
//On récupére tout le contenu de cette catégorie $page = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'exposition', 'post_status' => 'publish', 'posts_per_page' => 2, 'paged'=> $page ); $posts = new WP_Query( $args ); //On parcoure les posts while ( $posts->have_posts() ) : $posts->the_post(); //on récupere le post ID $postId = get_the_ID(); //On prépare la récupération des metabox $metaExpositions = get_post_meta($postId, 'dateExposition', TRUE); //on affiche echo '<div class="actu">'; echo '<div class="actuContent">'; echo '<h2>'.get_the_title().'</h2>'; echo '<p class="actuDate">'.$metaExpositions['reference'].'</p>'; the_content(); echo '</div>'; //On vérifit si il y a une miniature if(has_post_thumbnail($postId)){ //Et on affiche $thumbAttribut = array( 'class' => "actuThumb" ); echo '<div class="containerThumbActu">'; echo get_the_post_thumbnail($postId,'thumbnail',$thumbAttribut); echo '</div>'; } echo '</div>'; echo '<div class="spacer"></div>'; endwhile; //La pagination wp_pagenavi(array( 'query' => $posts ) );
Url generate by Wp Pagenavi is like
WordPress configuration :
– Version : 3.2
– Version PHP/MySQL : 5.3.0 / 5.1.36
– Thème : custom
– Plugins : Category Images II, Contact Form 7, TinyMCE Advanced, WP-DBManager, WP-PageNavi,WP No Category BaseEvery solutions found on internet doesn’t work with me !
Please help me, thanks.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Wp Pagenavi and custom post type problem’ is closed to new replies.