그러나 현재 위치와 관련하여 Wordpress에서 다음 두 글을 검색하려고합니다.Wordpress에서 다음 2 개의 게시물을 검색하는 방법
예를 들어 내가 게시 # 1에있는 경우 게시물 # 2 + # 3이 표시됩니다. 제가 게시물 # 7에 올 경우 게시물 # 8 + # 9가 표시됩니다. 가능하다면, 나는 이것들도 반복하고 싶다. 그래서 포스트 # 9가 마지막 포스트이고, 포스트 # 8을보고 있다면, 포스트 # 9 + # 1이 보일 것이다.
아무도 도와 줄 수 있습니까?
<?php
$args = array(
'post_type' => 'project',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => '2'
);
$query = new WP_Query($args);
?>
<?php if ($query->have_posts()) : ?>
<?php while ($query->have_posts()) : $query->the_post(); ?>
<div class="unit one-half">
<figure>
<?php if (has_post_thumbnail()) {
the_post_thumbnail();
} ?>
</figure>
<figcaption>
<h4><?php the_title(); ?></h4>
<h5><?php the_excerpt(); ?></h5>
<h6><a href="<?php the_permalink(); ?>">Read More</a></h6>
</figcaption>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
나는 쿼리 절 직접 작성해야합니다 생각, 그리고 현재 포스트 ID에 따라 달라집니다. 나는 WordPress에서 이것에 대한 내장 기능이 있다고 생각하지 않지만 SQL로 바로 가면 거기에 갈 것입니다. – Kukanani
[this post] (http://wordpress.stackexchange.com/a/174008/31545)를보십시오. 두 번째 마지막 게시물에있는 경우 첫 번째 게시물에 대한 링크를 표시하도록 수정해야합니다. –