Ok so I am having issues with linking to next and previous posts…
Here is my code:
<?php get_header(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
...
<div id="project-prev"> <?php previous_post_link('Prev'); ?> </div>
<div id="project-next"> <?php next_post_link('Next'); ?> </div>]
...
<?php endwhile; // end of the loop. ?>
<?php endif; ?>
<?php get_footer(); ?>
I have read places that next/prev posts requires a ‘new WP_Query’ query, but have had no such luck. There is no next/prev link rendered out on my site, using the above.
As always appreciate solutions and pointers.
Many thanks
Have you tried following (according to WordPress codex)
In your divs … 🙂 If you still encouter problems, then just try something like:
Should work.
EDIT:
First try and get the next and previous posts.
And then create to
<a>
tags and echo out the URLs we set above.One reason that could make these links not to show is having the posts set as draft. Only published posts will make the previous and next post links render.