1

I am new to wordpress. I am using my blog category to show all the posts as static pages. Every thing is fine except the pagination. When i googled i found that it's a known bug in wordpress.Here is my page.php code:

    <div id="primary">

        <div id="content" role="main">



            <?php while ( have_posts() ) : the_post(); ?>



                <?php get_template_part( 'content', 'page' ); ?>



                <?php comments_template( '', true ); ?>



            <?php endwhile; // end of the loop. ?>


        </div><!-- #content -->

    </div><!-- #primary -->

I am using list_category_post plugin for pagination but it not working with static pages. Please help me ?

Durga Dutt
  • 4,093
  • 11
  • 33
  • 48

1 Answers1

1

When I want to show posts on the static page, I generate the query myself.

I add something like this before while loop:

<?
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
   'posts_per_page' => 5,
   'paged' => $paged 
 );

$wp_query = new WP_Query($args);
?>

after the loop I would have navigation links:

<div id="nav-below" class="navigation">
  <div class="nav-previous"><?php next_posts_link(); ?></div>
  <div class="nav-next"><?php previous_posts_link(); ?></div>
</div><!-- #nav-below -->

and after that I would add wp_reset_query() to reset the original query, just in case some other code needs it.

<?php wp_reset_query(); ?>
user850010
  • 6,311
  • 12
  • 39
  • 60