Advertisement
Digitalraindrops

Latest Posts Ribbon

Sep 23rd, 2011
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php if( is_home() || is_front_page()  ) : ?>
  2. <div style="display: block; position: relative; width:100%, height: auto; margin: 10px auto; text-align:center;">
  3. <?php
  4. global $post;
  5. $tmp_post = $post;
  6. $args = array( 'numberposts' => 15 ); //Change the count for the theme
  7. $myposts = get_posts( $args );
  8. foreach( $myposts as $post ) : ?>
  9.     <?php if( has_post_thumbnail( $post->ID ) ) : ?>
  10.         <?php $link =  get_permalink( $post->ID ); ?>
  11.         <div style="float: left; display:inline; margin: 0 3px;" onclick="location.href='<?php echo $link; ?>'">
  12.             <?php /* Change the array(width,height) values to match the theme */ ?>
  13.             <?php echo get_the_post_thumbnail($post->ID, array(50,50) , 'thumbnail'); ?>
  14.         </div>
  15.     <?php endif; ?>
  16. <?php endforeach; ?>
  17. <?php $post = $tmp_post; ?>
  18. </div>
  19. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement