我已经为我的分类法和自定义帖子类型创建了自定义分类法模板,
自定义帖子类型名称为“ecommerce”,自定义分类法为“ecommerce\\u categories”,问题在于分页。它正确显示有2个页面包含帖子,但当我单击第2页时,我得到404页,只有在分类法页面上时才会出现这种情况,我还创建了一个自定义页面模板,该模板的作用与分类法文件相同,并且分页在这里(在自定义页面模板上)起作用。问题只出现在分类法类别页面上。这是文件taxonomy-ecommerce\\u categories的代码。php
<?php
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$term = $wp_query->queried_object;
$shop_loop = new WP_Query( array( \'post_type\' => \'ecommerce\', \'ecommerce_categories\' => $term->name, \'posts_per_page\' => 2, \'orderby\' => \'menu_order\', \'paged\'=>$paged ) ); ?>
<?php while ( $shop_loop->have_posts() ) : $shop_loop->the_post(); ?>
// here is my loop code with divs links etc.. etc...
<?php endwhile;?>
<div class="clearfix"></div>
<?php if(function_exists(\'wp_pagenavi\')) { wp_pagenavi( array( \'query\' => $shop_loop ) ); } ?>
我看到了分页,但当我单击第2页或第3页时,我会看到404错误页面,这会发生在任何永久链接设置中,并且如果我使用此代码将分页从wp pagenavi插件更改为wordpress默认值<?php wp_link_pages(); ?> or previous_post_link and next_post_link
我看不到,帖子下面什么都没有显示。我怎样才能解决这个问题?我做错了什么?