You will need 2 Loops. In the first Loop (showing the appropriate single post), grab the id of the post as a variable. In the second Loop, try setting up a custom query using the post id variable +1.
Hi,
Sorry, but variables are still a little bit beyond my skills. I’ve tried quite a few things with variables over the last hour but haven’t had any luck. Here is my latest attempt, which I haven’t been able to get working.
Beginning of first loop:
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php $addone = <?php the_ID(); ?>;
$nextpost = $addone+1;
?>
End of first loop and beginning of second loop:
<?php endwhile; ?>
<?php endif; wp_reset_query(); ?>
<?php $my_query = new WP_Query('showposts=1&p=$nextpost;'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
Is this along the lines of what you had meant?
Thanks again,
Nick
It looks about right – although you might want to try:
<?php $my_query = new WP_Query('posts_per_page=1&p=' . $nextpost); ?>
Also, this is pure theory. I’ve never tried it myself.
Didn’t work, but thanks for the effort.
http://codex.ww.wp.xz.cn/Function_Reference/get_adjacent_post
to check it, make a print out of the whole object:
<?php print_r( get_adjacent_post(false,'',true); ?>
i think, the id of the prev post is:
<?php $prev_id = get_adjacent_post(false,'',true)->ID; ?>