Get next 6 thumbnails – get_posts or loop?
-
Hi,
To begin with I started using the loop function to create a list of thumbnails but when I clicked on a thumbnail/link and got to the post page it only showed the thumbnail for the post. Therefore I’m using the get_posts.
So, I’ve made a list of thumbnails which are linked to their post. The list only needs to show 6 thumbnails at the time. The thing is that I need at “Next” and “Previous” button – just like using the loop.
My question is: Is it possible to make a “Next/Previous” function by using get_posts, or how can I make a list by using the loop function without having the problem when entering a post page?
My get_posts code:
<?php $lastposts = get_posts('numberposts=6'); foreach($lastposts as $post) : setup_postdata($post); ?> <?php $thumbnail = get_post_meta($post->ID, 'thumbnail', $single = true); ?> <?php if($thumbnail !== '') { ?> <div class="item fl"> <a href="<?php the_permalink() ?>"> <img src="<?php echo $thumbnail;?>" alt="<?php the_title(); ?>" border="0" class="pic_thumb"/></a> <?php } ?> </div> <?php endforeach; ?>I’m a sorta new to WordPress, so please, help me out here? :o)
The topic ‘Get next 6 thumbnails – get_posts or loop?’ is closed to new replies.