これは、一度に 2 つのイベントを表示する wordpress のイベント テンプレート ページですが、以前の投稿のリンクをクリックして古いイベントの投稿を表示すると、カスタム投稿タイプでこの 404 ページ エラーが発生し続けます。どんな助けでも大歓迎です。テンプレートページの完全なコードは次のとおりです。
<?php
/*
Template Name: Events Page
*/
?>
<?php get_header(); ?>
<div id="wrapper">
<section id="main-content">
<div class="signup">
<a href="#">Sign up for our mailing list</a>
</div>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article>
<?php the_content(); ?>
</article>
<?php endwhile; endif; ?>
<section id="event-listings">
<?php
$args = array(
'post_type' => 'events',
'posts_per_page' => 2,
'paged' => get_query_var('paged')
);
$global_posts_query = new WP_Query($args);
?>
<?php if ($global_posts_query->have_posts()) : while ($global_posts_query->have_posts()) : $global_posts_query->the_post(); ?>
<article class="post">
<div class="date">
<p><?php the_field('date'); ?><br><span class="year"><?php the_field('year'); ?></span></p>
</div>
<h2><?php the_field('headline'); ?></h2>
<p class="location"><?php the_field('location'); ?> ♥ <?php the_field('time'); ?></p>
<p class="coordinator">Created by: <span class="name"><?php the_field('author'); ?> on <time datetime="<?php echo date(DATE_W3C); ?>" pubdate class="updated"><?php the_time('F jS, Y') ?></time></span></p>
<p class="about-content"><?php the_field('about'); ?></p>
</article>
<?php endwhile; else: ?>
<p>No events posted at this time.</p>
<?php endif; ?>
<div class="navigation">
<div class="next-posts"><?php next_posts_link('« Older Entries', $global_posts_query->max_num_pages) ?></div>
<div class="prev-posts"><?php previous_posts_link('Newer Entries »', $global_posts_query->max_num_pages) ?></div>
</div>
</section>
</section><!--End Main Content-->
</div><!--End Wrapper-->
<?php get_footer(); ?>