Pulling single post AND post prior to that post
-
It’s a bit unusual, I know, but I’m designing a site in which I want posts, when displayed as single posts, to always display below them whatever post immediately preceded them chronologically in the same category, in order to always keep a sort of flowing, ongoing feel to posts.
But it’s proven trickier than I’d imagined.
Right now, I’ve basically got this:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php ($current = get_the_id()) ?>
[display post, end loop, etc…]
and then:
<?php $blog_query = new WP_Query('p=' . $current . '&offset=1'); while ($blog_query->have_posts()) : $blog_query->the_post(); ?>
But the offset command doesn’t work that way. Is there anything that can manipulate the Post_ID I’m summoning to pull the preceding Post_ID (in the same category)? Any other ideas of how to go about this?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pulling single post AND post prior to that post’ is closed to new replies.