在标准WordPress页面上,我有一个WP Query
这贯穿了我创建的一个帖子类型。与该查询一起,我使用paginate_links() 生成分页。虽然标准(无永久链接)似乎工作正常,但在启用任何永久链接组合时,不会加载后续分页页面。以下是我目前掌握的情况:
$post_args = array(
\'post_type\' => \'galleries\',
\'paged\' => get_query_var(\'paged\'),
\'post_type\' => \'galleries\'
);
$posts_query = new WP_Query($post_args);
$i = 0; // count
$total_items = $posts_query->post_count; // total profiles
$number_columns = $galleries_options[\'columns\']; // number of columns
if ($posts_query->have_posts() ) {
echo \'<div id="galleries-list">\';
while ($posts_query->have_posts() && ($i < $total_items)) { ?>
<?php $posts_query->the_post(); if ($i % $number_columns == 0) echo ($i > 0 ? \'</div><div class="row">\' : \'<div class="row first-row">\'); ?>
<div class="<?php echo \'width\'.intval(100 / $number_columns); ?> <?php if ($i % $number_columns == 0) echo \'first-item\'; ?>">
<?php
galleries_list(get_the_ID());
?>
</div>
<?php $i++;
}
echo \'</div>\';
echo \'</div>\';
$total_pages = $posts_query->max_num_pages;
$big = 999999999; // need an unlikely integer
if ($total_pages > 1){
$current_page = max(1, get_query_var(\'paged\'));
echo \'<nav class="page-nav">\';
echo paginate_links(array(
\'base\' => str_replace( $big, \'%#%\', esc_url( get_pagenum_link( $big ) ) ),
\'format\' => \'?paged=%#%\',
\'current\' => $current_page,
\'total\' => $total_pages,
\'prev_text\' => \'Prev\',
\'next_text\' => \'Next\'
));
echo \'</nav>\';
}
}
默认URL为
?page_id=60&paged=2
工作/负载良好-尚未
galleries/page/2/
没有。有人有什么建议吗?我正在使用完全相同的东西进行分类分页。。。所以我有点困惑为什么这不起作用。谢谢