请先看一下此快速视频:http://www.screenr.com/8vSH
The problem: get_next_posts_link()
在第4页消失。也就是说,“转到旧帖子”链接会在我进入后消失&paged=4
我的博客。但是,我可以手动键入eg。&paged=5
我确实收到了第五页的帖子(也就是说,帖子在那里,但是get_next_posts_link()
只是没有出现)。
So..
<打印我的帖子总数会返回正确的数量(33),这告诉我所有帖子都被正确查询了帖子和博客页面工作正常(即,我可以键入&;paged=5或6等),并且我确实可以获得带有相应帖子的特定博客页面我也试过了
next_posts_link()
无济于事
The current code looks like this:
echo \'<ul class="blog-navi">
<li class="blog-navi-prev">\'.get_next_posts_link($pagi_older_text, 0).\'</li>
<li class="blog-navi-next">\'.get_previous_posts_link($pagi_newer_text).\'</li>
</ul>\';
谢谢大家!
The posts query
get_header();
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$blogcats = $era_opts[\'era_opts_blog_thecats\'];
if(!isset($era_opts[\'era_opts_blog_thecats\'])) {
$blogcats = \'\';
} else {
$blogcats = implode(\',\', $blogcats);
}
$args = array(
\'post_type\' => \'post\',
\'numberposts\' => \'-1\',
\'paged\' => $paged,
\'category\' => $blogcats
);
$era_blog_posts = get_posts($args);
The added pre_get_posts function in functions.php
function era_blog_cats_wpse_103587($qry) {
if ($qry->is_page(122) && is_main_query()) {
$era_opts = get_option(\'era_theme_panel\');
$blogcats = $era_opts[\'era_opts_blog_thecats\'];
if(!empty($era_opts[\'era_opts_blog_thecats\'])) {
$qry->set(\'category__in\', $blogcats);
}
}
}
add_action(\'pre_get_posts\',\'era_blog_cats_wpse_103587\');