This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!

Latest Posts Ribbon

By: Digitalraindrops on Sep 23rd, 2011  |  syntax: PHP  |  size: 0.79 KB  |  views: 93  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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; ?>
clone this paste RAW Paste Data