I'm creating my first template.
This is the code. Should be self-explanatory.
<?php
$next_post = get_next_post();
if (!empty( $next_post )): ?>
<a href="<?php echo get_permalink( $next_post->ID ); ?>">
<span class="next"></span>
<div class="featured-image" style="background-image: url('<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>')"></div>
</a>
<?php endif; ?>
<div class="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?><?php the_content(); ?>
<?php endwhile; else: ?>
<?php _e(''); ?><?php endif; ?>
</div>
How can I make it repeat the cycle, start again at the first post, when all the posts have been cycled through?
At the moment it starts with the latest post and ends with latest. The first post has content of all other posts and no link for next post. The second post and all the following (except the last), have the right content, feature image and nicely link to the next post.
Thanks.
S