I've a custom theme based on this one http://underscores.me/. I've a custom taxonomy called event-bucket and custom post_type called bucket. I've a page where I can see all the buckets of an event-bucket:
mybesite.com/bucket/my-event-bucket/
This page works well and I use the_posts_navigation()
for the navigation and when I click on it it redirect to mybesite.com/bucket/my-event-bucket/page/2
wich come to a 404 page.
BUT when I put manually an url like mybesite.com/bucket/my-event-bucket?page=2
It come to the right page.
Do you know how can I fix the "Older Post" button working properly ?
Here is my archive.php the template called by mybesite.com/bucket/my-event-bucket/
<?php
/**
* The template for displaying archive pages.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package socialite
*/
get_header('bucket'); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
if ( have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="archive-description">', '</div>' );
?>
</header><!-- .page-header -->
<?php
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
query_posts( array( 'post_type' => 'bucket', 'paged' => $paged ) );
/* Start the Loop */
while ( have_posts() ) : the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_format() );
endwhile;
the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'none' );
endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
// get_sidebar();
get_footer();
bucket/my-event-bucket/
? That URL suggets the page for a singlebucket
calledmy-event-bucket
. The proper way to have a paginated archive ofbucket
s in a themy-event-bucket
term is to go toevent-bucket/my-event-bucket/
which will use taxonomy-event-bucket.php for the template (or fall back to archive.php/index.php). – Jacob Peattie Sep 5 '17 at 11:38