why Pagination not working..? please help
-
hello everyone,
i’m tried to do a page of post per category and found this solution in the forum.code start:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post-page" id="post-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <div class="entry entry_page"> <?php the_content('<p class="serif">keep reading »</p>'); ?> <?php wp_link_pages(array('before' => '<p><strong>pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> <?php edit_post_link('edit', '<br /><p>', '</p>'); ?> </div> </div> <?php endwhile; endif; ?>
and then it’s set the catID according to category name:
<?php $catID = 0; if (is_page('new')) { $catID=4; } if ($catID) { $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=$catID&paged=$paged"); } ?>
and then it’s showing the posts:
<?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="post-top"> <div class="post-date"> <?php the_time('M') ?> <p><?php the_time('d') ?></p> </div> <div class="post-title"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="link<?php if ( function_exists('the_title_attribute')) the_title_attribute(); else the_title(); ?>"><?php the_title(); ?></a></h2> <h3> publish by <?php the_author() ?> date <?php the_time('d-m-Y') ?> </h3> <?php if ( function_exists('the_tags')) the_tags('<h3 class="tags">tags: <span>', ', ', ' </span></h3>'); ?> </div> </div> and then it's have the pagination: <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« previous post') ?></div> <div class="alignright"><?php previous_posts_link('next post »') ?></div> </div>
and here are the problem,
if i have lot’s of post and i limited posts to 4 per page
a pagination appears to older posts, pressing it the page url will change to /page/2, so it’s increasing OK
BUT
the template show the same posts all over again it’s not replacing them with previous posts as it’s should be.
please help me on this issue.
here are a link to the complete code.
https://pastebin.com/4Tv2hK0G
thanks,
joe.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘why Pagination not working..? please help’ is closed to new replies.