WordPress show next 3 x number adjacent custom posts from existing
-
Hi
I’ve asked this question elsewhere with no joy. The idea I think is simple. I want to take the current post position and then show the next 3 posts in that custom post type in my sidebar. Right now I am pulling the current post and excluding that post fine, but it’s not really what I am looking for. Thi sis my current code:-
<ul> <?php $currentID = get_the_ID(); $query = new WP_Query(array('post_type' => get_post_type($post->ID), 'posts_per_page' => 5, 'order' => 'DESC', 'orderby' => 'date', 'offset' => $offset, 'page' => $page, 'post__not_in' => array($currentID) )); while ( $query->have_posts() ) : $query->the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; wp_reset_postdata(); ?> </ul>
The reason I need to do this is because the posts will be number 1,2, 3 etc so when you are on post 3 I want to show 4, 5, 6.
Thanks
Glennyboy
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘WordPress show next 3 x number adjacent custom posts from existing’ is closed to new replies.