Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //to show four random post thumbs
- $thumb_posts = new WP_Query(array(
- 'post_type' => 'post',
- 'ignore_sticky_posts' => 1,
- 'posts_per_page' => 4,
- 'meta_key' => '_thumbnail_id',
- 'orderby' => 'rand' ));
- if($thumb_posts->have_posts()) : ?>
- <div class="sub-post-thumbs">
- <?php while($thumb_posts->have_posts()): $thumb_posts->the_post();
- echo '<a href="' . get_permalink($post->ID) . '">' . get_the_post_thumbnail($post->ID,array(120,80)) . '</a>';
- endwhile; ?>
- </div>
- <?php endif;
- wp_reset_postdata();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement