2013-03-01 75 views
0

我需要爲單個類別創建一個循環。 一切工作正常,exept,我無法分割在多個部分的頁面。在wordpress中創建一個包含1個類別循環的多個頁面

這是我的頁面的LOOP。 輸出是好的,免除導航欄不顯示,只需添加到網址a/page/2它顯示前2個職位。

  <?php query_posts('cat=179&posts_per_page=2'); ?> 

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

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

      <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__('Permalink to %s', 'morlottiTabs'), the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a></h2> 


      <div class="entry-meta"> 
       <?php morlottiTabs_posted_on(); ?> 
      </div> 

      <div class="entry-content"> 
       <?php the_content(); ?> 
      </div><!-- .entry-content --> 

       <div class="entry-utility"> 
        <?php morlottiTabs_posted_in(); ?> 
        <?php edit_post_link(__('Edit', 'morlottiTabs'), '<span class="edit-link">', '</span>'); ?> 
       </div><!-- .entry-utility --> 
       </div> 
      <?php endwhile; endif; ?> 

      <?php /* Display navigation to next/previous pages when applicable */ ?> 
      <?php if ( $wp_query->max_num_pages > 1) : ?> 
          <div id="nav-below" class="navigation"> 
           <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', 'morlottiTabs')); ?></div> 
           <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', 'morlottiTabs')); ?></div> 
          </div><!-- #nav-below --> 

      <?php endif; ?> 

回答

0

你可以嘗試這樣做。還列出了其他一些分頁方法。

參考:http://digwp.com/2009/08/wordpress-page-navigation/

參考:http://codex.wordpress.org/Class_Reference/WP_Query


編輯:

你想嘗試不同的方法?

的WordPress都有自己的分頁方法

參考:http://codex.wordpress.org/Function_Reference/paginate_links

<?php echo paginate_links($args) ?> 
+0

不幸的是它並不能幫助我的問題。這是因爲我需要修復「循環」本身,而不是其他頁面的鏈接......似乎在我嘗試探索的每一頁(頁面2,頁面3)中,循環都從最後一篇文章重新開始。結果是我總是會獲得第一個帖子數量。 – 2013-03-04 11:26:02

+0

我只是編輯類別/檔案的循環,而不創建額外的頁面 http://www.morlotti.com/category/wedding-stories-emotion-through-photographs 我會修復佈局後:) – 2013-03-04 14:32:47

相關問題