Smarter navigation with previous/next thumbnails
-
Here is my current thumbnail navigation code:
<div id="post-nav"> <?php $prevPost = get_previous_post(true); if($prevPost) { $args = array( 'posts_per_page' => 1, 'include' => $prevPost->ID ); $prevPost = get_posts($args); foreach ($prevPost as $post) { setup_postdata($post); ?> <div class="post-previous"> <a>">?Previous Post</a> <a>"><?php the_post_thumbnail('thumbnail'); ?></a> <h4><a>"><?php the_title(); ?></a> </div> <?php wp_reset_postdata(); } //end foreach } // end if $nextPost = get_next_post(true); if($nextPost) { $args = array( 'posts_per_page' => 1, 'include' => $nextPost->ID ); $nextPost = get_posts($args); foreach ($nextPost as $post) { setup_postdata($post); ?> <div class="post-next"> <a>">Next Post?</a> <a>"><?php the_post_thumbnail('thumbnail'); ?></a> <h4><a>"><?php the_title(); ?></a> </div> <?php wp_reset_postdata(); } //end foreach } // end if ?> </div>
Any help here would be greatly appreciated. Thank you!
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Smarter navigation with previous/next thumbnails’ is closed to new replies.