Thesis Theme

Show Image Thumbails with Blog Excerpts or Posts on Static Homepage using the WordPress Thesis Theme

WordPress plus Thesis gives you the flexibility to easily customize your site with features such as displaying posts and thumbnails on your homepage.

Our post with instructions on how to Show Blog Posts on Static Homepage with WordPress Thesis Theme has generated a lot of responses from our visitors. We’re glad so many of you have found the post helpful; however, it seems that we did not cover everything: we receive a fair amount of questions about adding a posts image thumbnail along with the excerpt / post. Instead of having to piece this code together from the comments on the original post, we have now organized it below so you can simply paste the below code into custom_functions.php. If you are having any issues with getting the code to work, please see the notes at the bottom of this post:

function static_front_posts(){
if (is_front_page()) {
?>
<div id="my-static-front-posts">
<?php
$custom_loop = new WP_Query('showposts=10&amp;amp;amp;amp;orderby=date');
if ( $custom_loop->have_posts() ) :
while ( $custom_loop->have_posts() ) : $custom_loop->the_post();
echo '<div class="post type-post hentry post_box top">';
$post_image = thesis_post_image_info('thumb');
echo $post_image['output'];
echo '<div class="headline_area"><h2 class="entry-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
echo '<p class="headline_meta"><abbr title="" class="published">' . get_the_date() . '</abbr></p></div>';
echo '<div class="format_text entry-content"><p>' . get_the_excerpt() . '</p></div>';
echo '<a href="' . get_permalink() . '">' . '<span class="more-button">Read More</span></a>';
echo '</div>';
endwhile;
wp_reset_query();
endif;
?></div><?php
 }
 }
add_action('thesis_hook_after_content','static_front_posts');

Refresh your homepage and voila, image thumbnails should show along with the excerpts.

PLEASE NOTE: For image thumbnails to show, ensure that you have added an image to your post. Also, for the above code to work properly, you need set your front page to a static page and set up a blog page for your posts. For more info, please see our original post about adding posts to a static front page.

11 Comment on “Show Image Thumbails with Blog Excerpts or Posts on Static Homepage using the WordPress Thesis Theme

Leave a Reply

Your email address will not be published. Required fields are marked *