同様の質問が寄せられていますが、ここでの私の状況には当てはまらないようです。WP サイトに 2 つのカスタム投稿タイプを組み込みました。最初の各投稿タイプをキャプチャするために、single-first_one.php を作成しました。それは完全に機能し、追加したページネーションも機能します。
2 番目の投稿タイプ、single-second_one.php を作成しました。この「単一」ページには、現在の投稿と、その下に最新の 6 つの投稿が表示されています。ページネーション リンク (single-second_one.php 内) を除いて、すべてが正常に表示されています。コードは最初の 'single' テンプレートのコードとほぼ同じなので、なぜ機能しないのかわかりません。何か助けはありますか?
<?php get_header(); ?>
<h1>Events</h1>
<section id=featured_post>
<?php $paged = (get_query_var('paged') && get_query_var('paged') > 1) ? get_query_var('paged') : 1; ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h5 class=previous><?php previous_post_link('%link'); ?></h5>
<h5 class=next><?php next_post_link('%link'); ?></h5>
<article class="post-<?php the_ID(); ?>">
<div>
<?php if ( has_post_thumbnail()) : ?>
<?php the_post_thumbnail(); ?>
<?php endif; ?>
</div>
<h2><?php the_title(); ?></h2>
<h3><?php the_time('l F j'); ?></h3>
<?php the_content(); ?>
</article>
<?php endwhile; ?>
<?php else: ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</section>
<h1>Upcoming Events</h1>
<section id=other_posts>
<?php
$args = array('post_type' => 'event', 'showposts' => 6, 'order' => 'ASC', 'post_status' => 'future');
$loop = new WP_Query($args);
if ( have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post();?>
<article class="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<h3><?php the_time('l F j'); ?></h3>
<?php html5wp_excerpt('events_page_listing'); ?>
</article>
<?php endwhile; else: ?>
<?php endif; ?>
</section>
オプション -> パーマリンクに移動し、すべてをキャッシュし、最近の 6 つの投稿を呼び出す後半のセクションを取り出し、single-first_one.php をすべて取り出しましたが、何も機能しません。2 番目の単一ページのページネーションの は空です。
編集
endwhile の後、endwhile と else の間など、次/前の呼び出しを移動しようとしましたが、何も機能していません。他のsingle.phpページでは、すべてがまったく同じように設定されており、次/前の投稿リンクが完全に表示されているため、非常に奇妙です。
編集
ページネーション引数を追加しましたが、まだ機能していません。