我进入第二页时在wordpress中使用wp_pagenavi插件,但它得到404错误页面。
插件URL: https://wordpress.org/plugins/wp-pagenavi/
页面网址: http://roymans.devserver1.nl/productcategorieen/blindklinknagels/spreid-blindklinknagels/
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => 2, 'paged' => $paged );
if($parent_term->slug) {
$args['tax_query'][] = array('taxonomy' => 'product_cat','field' => 'slug','terms'=>$parent_term->slug);
}
$loop = new WP_Query( $args );
if($loop->have_posts()) {
?>
<!-- start kennis_Txt -->
<section class="kennis_Txt largeproduct in_de_sec ">
<div class="center_container clearfix">
<div class="blok_3 clearfix category-product-block">
<h3 class="align-center"><?php echo $parent_term->name; ?></h3>
<div class="category-product-wrap">
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="keni_blok">
<div class="img_blk p-10"> <a href="<?php the_permalink(); ?>">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('project-thumb');
}
else {
echo '<img src="' . get_bloginfo( 'stylesheet_directory' )
. '/images/no-product.png" />';
}
?>
<?php ?>
</a> </div>
<div class="txt_blk">
<div class="pad_t">
<h2>
<?php the_title(); ?>
</h2>
<p><?php echo substr(strip_tags(get_the_excerpt()), 0, 300); ?>...</p> <a href="<?php the_permalink(); ?>" class="ovr_btn">Bekijk product</a> </div>
</div>
</div>
<?php endwhile; ?>
<div class="clearfix"></div>
<div class="navigation">
<?php wp_pagenavi( array( 'query' => $loop ) ); ?>
</div>
</div>
</div>
</div>
</section>
<?php } ?>