【发布时间】:2020-02-22 11:44:08
【问题描述】:
在 wordpress 站点中,我有一个循环,可以在页面上显示某个类别的帖子。我有一个分页代码。显示分页。但是,如果我转到第 2、3、4 页……显示的结果始终是第一页。有人看到错误吗?
感谢您的帮助。我看不到错误。
我的代码:
<a class="xyz" href="<?php the_permalink(); ?>"></a>
<h3 class="entry-title"><?php the_title(); ?></h3>
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('medium');
}
?>
<?php the_excerpt(); ?>
</div><!-- grid-item -->
<?php
endwhile;
$total_pages = $tk_specials_querie->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('page'));
$paginate_links = paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => '/page/%#%',
'current' => $current_page,
'total' => $total_pages,
'show_all' => False,
//'end_size' => 1,
// 'mid_size' => $pagerange,
'prev_next' => True,
'type' => 'plain',
'end_size' => 1,
'mid_size' => 2,
'prev_text' => __('« prev'),
'next_text' => __('next »'),
'type' => 'plain',
'add_args' => false,
'add_fragment' => ''
));
}
?>
<?php
else :
esc_html_e( 'Derzeit keine Beiträge!', 'text-domain' );
endif;
wp_reset_postdata();
?>
【问题讨论】: