Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Something like this, no excerpts or anything else. I couldn't find any plugin that can do it:

enter image description here

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You could use wp_get_recent_posts() to get the latest posts, like:

<h2>Recent Posts</h2>
<ul>
<?php
    $args = array( 'numberposts' => '5' );
    $recent_posts = wp_get_recent_posts( $args );
    foreach( $recent_posts as $recent ){
        echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
    }
?>
</ul>

Then, use get_the_post_thumbnail() to get the Featured Image of the posts, like:

if ( has_post_thumbnail($thumbnail->ID)) {
  echo '<a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">';
  echo get_the_post_thumbnail($thumbnail->ID, 'thumbnail');
  echo '</a>';
}

Mix it all together, and you could have something like this in the end:

<h2>Recent Posts</h2>
<ul>
<?php
    $args = array( 'numberposts' => '5' );
    $recent_posts = wp_get_recent_posts( $args );
    foreach( $recent_posts as $recent ){
        if ( has_post_thumbnail($recent["ID"])) {
            echo '<li>' . get_the_post_thumbnail($recent["ID"], 'thumbnail') . '</li>';
        }
    }
?>
</ul>

Finally, add some CSS:

ul { list-style: none; }
ul li { display: block; width: 45%; float: left; }

You sure have to style this one more than I did ;-)

share|improve this answer
    
Thanks for the quick reply. It doesn't seem to be doing the grid like thing only single column. Which is mainly what I was looking for. Single column can be achieved with some plugins, but not grid. –  bran Jan 15 '13 at 14:21
    
You have to add come CSS to make things look nice, i'll add some CSS to my answer, so you have a start to work with –  Mike Madern Jan 15 '13 at 14:25
    
Not really. I was using a plugin that doesn't have much css customization option. –  bran Jan 15 '13 at 14:29
    
Mike. I will come back to this tomorrow and see if it work (I am sure it will). Need to run for now. Thanks. –  bran Jan 15 '13 at 14:33
    
I used a different plugin, but this worked too. :) –  bran Jan 16 '13 at 11:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.