@正如我之前评论的那样,goldenapples,您的代码提供了一个良好的开端,但在上一页提供了一些不必要的帖子。我添加了一个函数来过滤posts\\u where,它计算第一页中最后一篇帖子的日期,并过滤出比它早的帖子。它似乎做到了这一点,但我不完全确定其中是否有bug。你能看看这个函数并说出你的观点吗:
add_filter( \'posts_where\' , \'tc_special_posts_where\' );
function tc_special_posts_where( $where ) {
global $wpdb, $paged, $post;
$paged = get_query_var(\'paged\');
$g = get_posts(\'numberposts=7&meta_key=_pull_leading3&meta_value=off&paged=0\');
foreach ($g as $p) { $i = $p->post_date; }
if (is_home() && $paged > 0) {
$where .= " AND post_date < \'" . $i . "\'";
}
return $where; }
更重要的是,由于我们更改了$paged
next_posts_link() 在这种情况下,将当前页显示为下一页,因此我必须进行一些替换-
$uri = $_SERVER["REQUEST_URI"];
$x = preg_match(\'/(\\d){1,}/\', $uri, $matches); //catch the digit of page number
$nextlink = get_next_posts_link(\'Next Page »\', 0);
if ($matches) { //on the first page not needed to replace, only from page 2 and on
$nextlink = preg_replace(\'/(\\d){1,}/e\', \'"$1"+1\' ,$nextlink);
}
<span class="alignleft"><?php echo $nextlink;?></span>