2012-02-02 91 views
1

我搜索并搜索了,并没有解决我的问题。我似乎有解决方案,但他们不适合我的特定代码。WordPress - 分页不能在自定义循环上工作

我想要做的是有两个循环 - 一个调用最近的帖子并作为主要的“特色帖子”。其次是简单的第二个最近发表的文章,风格不同 - 然后低于第二个或“副职”我想分页。

问题是......分页不起作用。数字显示出来,但是当我点击它们时,没有任何反应。将不胜感激任何帮助!

下面是代码...

<div id="featuredpost"> 

    <?php $my_query = new WP_Query('posts_per_page=1&cat=4'); 
    while ($my_query->have_posts()) : $my_query->the_post(); 
    $do_not_duplicate = $post->ID; ?> 

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> 

     <span class="subposttitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></span><br> 
     <small>Posted in <?php the_category(', ') ?> on <?php the_time('l, F jS') ?>.</small> 
<br><br> 

     <div class="entry"> 
      <?php the_content(); ?> 
     </div> 

    </div> 
<br> 
<hr> 
<br><br> 
<?php endwhile; ?> 

</div> 

<div id="subposts"> 

<?php $my_query = new WP_Query('posts_per_page=1&offset=1&cat=4'); 
while ($my_query->have_posts()) : $my_query->the_post(); 
$do_not_duplicate = $post->ID; 

?> 

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> 

     <span class="subposttitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></span><br> 
     <small>Posted in <?php the_category(', ') ?> on <?php the_time('l, F jS') ?>.</small> 
<br><br> 

     <div class="entry"> 
      <?php the_content(); ?> 
     </div> 

    </div> 
<br> 
<hr> 
<br> 

<?php endwhile; ?> 

<center> 
<?php wp_pagenavi() ?> 
</center> 

</div> 

回答

0

通多个属性以wp_query作为数组:

<?php $wp_query = new WP_Query(array('posts_per_page' => 1, 'cat' => 4)); 
相关问题