Custom Page Template Pagination not working
-
Hello all, I made a custom page template that queries the category with the slug = aktualne. I use this custom page template in my Events page to display posts with the category = aktualne:
<?php /* Template Name: Aktualne */ ?> <?php get_header(); ?> <section class="content"> <?php get_template_part('parts/page-title'); ?> <div class="pad group"> <?php get_template_part('parts/featured'); ?> <?php query_posts('category_name=aktualne') ?> <?php if (have_posts() ) : ?> <div class="post-list group"> <?php $i = 1; echo '<div class="post-row">'; while (have_posts() ) : the_post(); ?> <?php get_template_part('content'); ?> <?php if($i % 2 == 0) { echo '</div><div class="post-row">'; } $i++; endwhile; echo '</div>'; ?> </div><!--/.post-list--> <?php get_template_part('parts/pagination'); ?> <?php endif; ?> <?php wp_reset_query() ?> </div><!--/.pad--> </section><!--/.content--> <?php get_sidebar(); ?> <?php get_footer(); ?>
But there seems to be a problem in my pagination. It displays the pagination but when I click on a page number eg. page 2. it directs to this link /aktualne/page/2/. BUT what displays in that link are the same posts displayed on the first page. And when I click on other pages like page 3. or 4., it also displays the posts of the first page.
This is the codes on parts/pagination:
<nav class="pagination group"> <?php if ( function_exists('wp_pagenavi') ): ?> <?php wp_pagenavi(); ?> <?php else: ?> <ul class="group"> <li class="prev left"><?php previous_posts_link(); ?></li> <li class="next right"><?php next_posts_link(); ?></li> </ul> <?php endif; ?> </nav><!--/.pagination-->
May I ask you for your help please?
Thank you!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom Page Template Pagination not working’ is closed to new replies.