I'm trying to add next/prev links to my wordpress post. This is the code for it:
<div id="demo">
<?php
$the_query = new WP_Query( array(
'category_name' => 'Case Study',
'posts_per_page' => 1,
));
?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<div class="nav-previous alignleft"><?php next_post_link('« %link', '%title', TRUE); ?></div>
<div class="nav-next alignright"><?php previous_post_link('« %link', '%title', TRUE); ?></div>
<?php else : ?>
<p><?php __('No News'); ?></p>
<?php endif; ?>
</div>
However, this doesn't work and the next/prev links don't show. Any ideas what I'm doing wrong?