admin管理员组文章数量:1130349
I'm using a page as archive for a custom post type called event.
register_post_type('event', array(
'labels' => array(
'name' => 'Événements',
'singular_name' => 'Événement',
),
'public' => true,
'has_archive' => false,
'hierarchical' => false,
'menu_icon' => 'dashicons-calendar-alt',
'rewrite' => array(
'with_front' => false,
'slug' => 'evenements'
)
));
Then, I defined this page template to template-event.php, where I use the following code to loop through post types.
$args = array(
'post_type' => 'event',
'posts_per_page' => 6,
'paged' => get_query_var('paged')
);
$the_query = new WP_Query( $args );
if( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
the_title();
endwhile;
wp_pagenavi( array( 'query' => $the_query ) );
wp_reset_postdata();
endif;
?>
This code works great for my home.php page, but not for this one.
Any idea why?
I'm using a page as archive for a custom post type called event.
register_post_type('event', array(
'labels' => array(
'name' => 'Événements',
'singular_name' => 'Événement',
),
'public' => true,
'has_archive' => false,
'hierarchical' => false,
'menu_icon' => 'dashicons-calendar-alt',
'rewrite' => array(
'with_front' => false,
'slug' => 'evenements'
)
));
Then, I defined this page template to template-event.php, where I use the following code to loop through post types.
$args = array(
'post_type' => 'event',
'posts_per_page' => 6,
'paged' => get_query_var('paged')
);
$the_query = new WP_Query( $args );
if( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
the_title();
endwhile;
wp_pagenavi( array( 'query' => $the_query ) );
wp_reset_postdata();
endif;
?>
This code works great for my home.php page, but not for this one.
Any idea why?
本文标签: pluginsPageNavi redirects to 404 when used as archive page
版权声明:本文标题:plugins - PageNavi redirects to 404 when used as archive page 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749024173a2304840.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论