2012-02-02 63 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));