在front-page.php上的Wordpress静态页面分页

时间:2015-09-27 15:57:23

标签: php wordpress pagination

我一直在尝试在静态页面上应用关于Wordpress分页的论坛上提供的答案,但似乎无法使它们在我的页面上运行。 我能够做的最接近的是一个分页系统加载一个页面,这些帖子甚至没有作为摘录上传,而是以完整的形式提供。

我正在寻找的答案是“分页”,只要我点击“较旧”的帖子,就可以在网站的同一首页上传旧帖子,而另一种方式是“更新”。

我的Wordpress阅读设置如下:

静态页面 首页:主页, 帖子页面:首页

我的front-page.php代码是(使用bootstrap嵌套我的页面列):

<!----- POSTS COLUMN BEGIN ------------->
<div class="col-xs-12 col-sm-8 col-md-8"> 
<?php 

    query_posts('posts_per_page=5');
    while(have_posts()) : the_post(); ?>
    <date class="text-muted"><?php the_date("m.d.Y") ?></date>
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <p><?php the_excerpt(); ?></p>
<hr>

<?php endwhile; wp_reset_query(); ?>


<br >

<!---- PAGINATION BUTTONS BEGIN ------->

<nav>
  <ul class="pager">
    <li class="previous"><a href="#"><span aria-hidden="true">&larr;</span>Older Posts</a></li>
    <li class="next"><a href="#">Newer Posts <span aria-hidden="true">&rarr;</span></a></li>
  </ul>
</nav> 
    
    
<!---- PAGINATION BUTTONS END ---------> 
</div>
<!----- POSTS COLUMN END ------------->

目前functions.php不包含任何有关分页的内容。我也离开了“老年人”和代码中的“较新”按钮。

提前感谢您的帮助!

0 个答案:

没有答案
相关问题