
Latest Posts Ribbon
By:
Digitalraindrops on
Sep 23rd, 2011 | syntax:
PHP | size: 0.79 KB | hits: 83 | expires: Never
<?php if( is_home() || is_front_page() ) : ?>
<div style="display: block; position: relative; width:100%, height: auto; margin: 10px auto; text-align:center;">
<?php
global $post;
$tmp_post = $post;
$args = array( 'numberposts' => 15 ); //Change the count for the theme
$myposts = get_posts( $args );
foreach( $myposts as $post ) : ?>
<?php if( has_post_thumbnail( $post->ID ) ) : ?>
<?php $link = get_permalink( $post->ID ); ?>
<div style="float: left; display:inline; margin: 0 3px;" onclick="location.href='<?php echo $link; ?>'">
<?php /* Change the array(width,height) values to match the theme */ ?>
<?php echo get_the_post_thumbnail($post->ID, array(50,50) , 'thumbnail'); ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php $post = $tmp_post; ?>
</div>
<?php endif; ?>