你可以用get_previous_posts_link
和get_next_posts_link
要确定它们是否存在,请执行以下操作:
$prev_link = get_previous_posts_link(__(\'« Older Entries\'));
$next_link = get_next_posts_link(__(\'Newer Entries »\'));
// as suggested in comments
if ($prev_link || $next_link) {
echo \'<ul class="navigation">\';
if ($prev_link){
echo \'<li>\'.$prev_link .\'</li>\';
}
if ($next_link){
echo \'<li>\'.$next_link .\'</li>\';
}
echo \'</ul>\';
}
希望这有帮助