Use the pagination with WP__query
-
Hello all.
First of all, I want to specify that I’m French, and my English is not very good. So excuse me in advance if I do some faults.I’m actually making a WordPress Theme, I’ve do the photoshop model and now I must do the code part. I use a static home page, so the template of my home page use the query for call all posts. But I’m trying to put the pagination after the posts.
Here is the loop in my Home.php:<!-- BOUCLE --> <?php $query = new WP_query(array('post_type'=>'post')); $query->query('category_name='.$catname.'&showposts=3'.'&paged='.$paged); while($query->have_posts()): $query->the_post(); global $post; ?> <div class="content"> <div class="post_title"><h1><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1></div> <div class="post_content"><?php global $more; $more = 0; the_content('Lire la suite'); ?></div> </div> <?php endwhile; ?> <!-- FIN BOUCLE --> <div class="clear"></div> <div class="navigation"> <?php next_posts_link('« Older Entries', $query->max_num_pages) ?> <?php previous_posts_link('Newer Entries »') ?> </div>
The “Older Entries” link show up, and when I click it, he take me to the good link (https://myurl/page/numofthepage) but the page show the same posts. On all of pages I can only see the 3 firsts posts.
How I can solve it ?
Thank’s you in advance ??
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Use the pagination with WP__query’ is closed to new replies.