What I need is one post (feature image+content text) per page. When you click on a fullscreen div (class=next)on top of everything, then next post loads per page. When the oldest and last post appears, clicking on its feature image loads the first post again (latest post added by date). One post per page. Infinite cycle of posts by adding date, starting with the latest post added.
Below is the code with two problems to solve.
- Oldest post does not cycle back to the first post, to create an infinite cycle of posts.
The index (latest post )loads all content from all posts, all the next posts are fine, containing only their content.
<a href="<?php echo get_permalink( get_adjacent_post( false, '', true ) ); ?>"> <span class="next"></span> <div class="featured-image" style="background-image: url('<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>')"></div></a> <div class="content"> <?php $query = new WP_Query( array( 'posts_per_page' => '1', 'order' => 'DESC', 'orderby' => 'date' ) ); while($query->have_posts()){ $query->the_post(); } ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?><?php the_content(); ?> <?php endwhile; else: ?> <?php _e(''); ?><?php endif; ?> </div>
Need help! Thanks!
S