4 回答
TA贡献1900条经验 获得超5个赞
试试下面(替换你的html)
<?php
global $loop;
$query = $query ? $query : $loop;
$big = 999999999;
$paginate = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'type' => 'array',
'total' => $query->max_num_pages,
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'prev_previous' =>('← Older posts'),
'prev_next' => ( 'Newer posts →' ),
'prev_text' => __('«'),
'next_text' => __('»'),
));
if ($query->max_num_pages > 1) :
?>
<div class="paginate">
<ul class="pagination">
<?php
foreach ( $paginate as $page ) {
echo '<li>' . $page . '</li>';
}
?>
</ul>
</div>
<?php endif; ?>
TA贡献1848条经验 获得超10个赞
我最近遇到了同样的问题。不知道是什么问题,但这对我有用。
$pagination = [
'base' => @add_query_arg('paged','%#%'),
'format' => '',
'total' => $the_query->max_num_pages,
'current' => get_query_var('paged') ?? 1,
'show_all' => false,
'mid_size' => 4,
'type' => 'list',
'next_text' => '»',
'prev_text' => '«'
];
echo paginate_links($pagination);
TA贡献1811条经验 获得超6个赞
代替
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $loop->max_num_pages
) );
和
global $loop;
$query = $query ? $query : $loop;
$big = 999999999;
$paginate = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'type' => 'array',
'total' => $query->max_num_pages,
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'prev_previous' =>('← Older posts'),
'prev_next' => ( 'Newer posts →' ),
'prev_text' => __('«'),
'next_text' => __('»'),
));
if ($query->max_num_pages > 1) :
如果不起作用,我有另一个解决方案,请问我
- 4 回答
- 0 关注
- 132 浏览
添加回答
举报