WP-PageNavi在自定义页面上无法正常工作

时间:2013-06-20 07:24:31

标签: wordpress post wordpress-plugin categories

我创建了一个自定义页面,该页面仅显示来自特定类别的帖子,我还设置了wordpress以仅显示4个帖子。现在问题是WP-PageNavi无法正常工作。这是代码。

<div class="sixteen columns latest_post">

<?php query_posts('cat=3', 'posts_per_page=-1=-'); if(have_posts()) : while(have_posts()) :the_post(); ?>
   <div class="sixteen columns alpha omega outer_box">
       <div class="inner_box articles">

           <!--TITLE OF THE POST -->
           <h3 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>



           <ul class="data">
             <li><?php the_author_posts_link() ?> /</li>
             <li><?php the_category(', ') ?> /</li>
             <li><?php the_time('F jS, Y') ?> /</li>
             <li><?php comments_number() ?></li>
           </ul>

           <hr>

           <!--THUMBNAIL -->
           <div class="align_thumbnail_right">
              <?php if ( has_post_thumbnail()) the_post_thumbnail('home-thumb'); ?>

           </div>

           <div class="content">
              <!--TEXT -->
              <?php the_excerpt(); ?>


             <a href="<?php echo get_permalink(); ?>"><span>Read More</span></a>
           </div>

        </div>

   </div>

<?php endwhile; endif; wp_reset_query();?>

<!--PAGINATION -->

<div class="pagination">
<?php wp_pagenavi(); ?>
</div>

我在索引页面上应用了插件,似乎工作正常。但是当我在自定义页面上尝试它时它不起作用。

2 个答案:

答案 0 :(得分:1)

请添加此

wp_reset_query();

下面

wp_pagenavi();

希望它运作良好

答案 1 :(得分:1)

Wp_page navi需要query_post函数中的'paged'参数

转到此链接

http://codex.wordpress.org/Function_Reference/query_posts

和ctrl + f word'分页'他们,你会得到你的问题的答案。

可能有帮助。

相关问题