我想在页脚添加上一页和下一页链接,因此我可以将每页限制为 5 个帖子。我不想要下一篇文章和上一篇文章。我尝试将其放入和退出 WP 循环..但仍然无法正常工作!我对这个 WordPress 的东西是全新的。我已经为 single.php 实现了下一篇文章和上一篇文章。我想在 index.php 和 /categories/ 等其他页面上使用上一篇文章和下一篇文章,但不是 single.php。
<footer id="home-footer">
<?php posts_nav_link('','<','>'); ?>
<div class="wrapper">
<p id="home-extra">You can find more articles at the <a href="/archive">archive</a>.</p>
</div><!--end .wrapper -->
<div class="footer-wrapper">
<div class="projects">
<h1 id="projects-title">Projects</h1>
<ul class="footer-list">
<li><a href="http://dribbble.com/MatthewKosloski/projects/129666-iOS-Betas">iOS Betas</a></li>
</ul>
</div><!-- end .projects -->
<div class="recent">
<h1 id="recent-title">Recent Posts</h1>
<ul class="footer-list">
<?php
$args = array( 'numberposts' => '5' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . $recent["post_title"].'</a> </li> ';
}
?>
</ul>
</div><!-- end .recent -->
<div id="dribbble"><h1 id="recent-title">What i'm working on</h1></div>
<script type="text/javascript" src = "https://halfcourtshot.googlecode.com/svn/tags/1/js/half-court-shot.jsapp.mh.min.js"></script>
<script type="text/javascript">var hcs = new HalfCourtShot({ jersey: "matthewkosloski", shots: 3, goal: 'dribbble' });</script>
</div><!-- end .footer-wrapper -->
<div class="note-wrapper">
<p id="note">© 2013 Matthew Kosloski</p>
</div><!-- end .note-wrapper-->
</footer>