2012-07-17 44 views
-2

在Wordpress閱讀選項中,我將其設置爲使索引最多隻顯示2個帖子。但是,下一頁和上一頁按鈕丟失。我進入了我的模板,嘗試了默認的方法,但都沒有工作。WordPress內置分頁不起作用

我嘗試添加

<?php posts_nav_link(); ?> 

沒有工作。我然後嘗試

<div class="navigation"> 
    <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div> 
    <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div> 
</div> 

哪些也沒有工作。完全沒有在最終頁面的源代碼中顯示出來。這些是默認的WordPress功能,對嗎?這裏出了什麼問題?

如果它有什麼用途,這裏的index.php文件

<?php get_header(); ?> 

<section class="content"> 
    <ul class="items wrap"> 
     <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
     <h1><?php the_title(); ?></h1> 
     <h4><?php the_time('F jS, Y') ?></h4> 
     <p><?php the_content(__('(more...)')); ?></p> 
     <hr> 
     <?php endwhile; else: ?> 
     <p><?php _e('Sorry, we couldn’t find the post you are looking for.'); ?></p> 
     <?php endif; ?> 
     <!-- I added the pagination code here. --> 
    </ul> 
</section> 

<div id="delimiter"></div> 

<?php get_footer(); ?> 

謝謝!

回答

0

原來只有兩個帖子可以顯示,所以當然不會顯示下一個/上一個鏈接。所以它就是這樣,問題解決了。