0
是否可以将下一个和上一个帖子链接添加到查询来自一个类别的帖子并在每个页面上显示该类别的一个帖子的页面?Paginate Wordpress中的帖子的类别页面
这是我目前有:
<?php query_posts('cat=2&posts_per_page=1'); ?>
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
<!-- article -->
<article class="overlay" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="inner">
<div class="gallery" style="background-image: url(<?php the_field('image'); ?>);">
<div class="close" data-home="<?php echo home_url(); ?>">
<span class="oi" data-glyph="x"></span>
</div>
</div>
<div class="copy">
<h2><?php the_title(); ?></h2>
<?php the_field('news_content'); ?>
<a href="**NEXT_POST_IN_SAME_CATEGORY**">Next</a>
</div>
</div>
</article>
<!-- /article -->
<?php endwhile; ?>
'query_posts'打破主查询对象和分页,所以你的代码将无法工作。你应该**从来没有**使用'query_posts' –