我试图理解为什么我的分页从第二页开始,每页都会出现404错误。现在在我设置的阅读设置中Blog pages show at most
至1。
<?php
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$query = new WP_Query(
array(
\'post_type\' => \'behold_testimonials\',
\'orderby\' => \'rand\',
\'paged\' => $paged
)
);
if ($query->have_posts()):
while ($query->have_posts()): $query->the_post();
include( locate_template( \'/elements/testimonials-thumbnail.php\', false, false ) );
endwhile;
?>
<div class="l-pagination">
<?php
// kirki settings
$pagination_layout = get_theme_mod( \'posts_general__pagination-style\', true );
if( \'layout-1\' == $pagination_layout ) {
$pagination_layout_style = \'pagination-1\';
} elseif( \'layout-2\' == $pagination_layout ) {
$pagination_layout_style = \'pagination-2\';
}
?>
<div class="c-pagination <?php echo $pagination_layout_style; ?>">
<?php
$total_pages = $query->max_num_pages;
echo paginate_links( array(
\'base\' => str_replace( 999999999, \'%#%\', esc_url( get_pagenum_link( 999999999 ) ) ),
\'format\' => \'?paged=%#%\',
\'total\' => $total_pages,
\'current\' => max(1, get_query_var(\'paged\')),
\'prev_text\' => __( \'<i class="fas fa-caret-left"></i>\', \'behold-standard\' ),
\'next_text\' => __( \'<i class="fas fa-caret-right"></i>\', \'behold-standard\' ),
) );
?>
</div>
</div>
<?php
wp_reset_postdata();
endif;
?>
我的错在哪里?