21,886
社区成员
发帖
与我相关
我的任务
分享
<?php
$prev_post = get_previous_post();//与当前文章同分类的上一篇文章
$next_post = get_next_post();//与当前文章同分类的下一篇文章
?>
<?php if (!empty( $prev_post )): ?>
<a class="prevs" href="<?php echo get_permalink( $prev_post->ID ); ?>" title="<?php echo $prev_post->post_title; ?>"></a>
<?php endif; ?>
<?php if (!empty( $next_post )): ?>
<a class="nexts" href="<?php echo get_permalink( $next_post->ID ); ?>" title="<?php echo $next_post->post_title; ?>"></a>
<?php endif; ?>
<div id="postnavi">
<span class="prev"><?php if (get_previous_post()) { previous_post_link('上一篇: %link');} else {echo "当前是: 最后文章";} ?></span>
<span class="next"><?php if (get_next_post()) { next_post_link('下一篇: %link');} else {echo "当前是: 最新文章";} ?></span>
<div class="clear"></div>
</div>
<?php
$prev_post = get_previous_post();//与当前文章同分类的上一篇文章
$next_post = get_next_post();//与当前文章同分类的下一篇文章
?>
<?php if (!empty( $prev_post )): ?>
<a class="prevs" href="<?php echo get_permalink( $prev_post->ID ); ?>" title="<?php echo $prev_post->post_title; ?>"></a>
<?php endif; ?>
<?php if (!empty( $next_post )): ?>
<a class="nexts" href="<?php echo get_permalink( $next_post->ID ); ?>" title="<?php echo $next_post->post_title; ?>"></a>
<?php endif; ?>
<div id="postnavi">
<span class="prev" style="float:left;clear:both"><?php if (get_previous_post()) { previous_post_link('上一篇: %link');} else {echo "当前是: 最后文章";} ?></span>
<span class="next" style="float:left:clear:both"><?php if (get_next_post()) { next_post_link('下一篇: %link');} else {echo "当前是: 最新文章";} ?></span>
<div class="clear"></div>
</div>