get_next_post returns null
-
On my single.php i would like to show a “preview” of the next and the previous post.
get_next_post() and get_previous_post() should do the job but they both return Null.Is there something I’m doing wrong ?
<?php get_header(); ?> <section id="portfolio"> <?php get_next_post(); ?> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content-single' ); ?> <?php endwhile; ?> <?php else : ?> <!-- .. --> <?php endif; ?> <?php get_previous_post(); ?> </section> <?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘get_next_post returns null’ is closed to new replies.