Setting Featured Image For Posts in WordPress

WordPress added the ability to set a Featured Image for your posts in version 2.9. There are a couple of steps you need to take to get them to show up on your posts, so here is the easy way to do this without using a plugin:

  1. Open your functions.php file and make sure this line is there:
    add_theme_support( ‘post-thumbnails’ );
    This does what it says on the tin and lets you use thumbnails/featured images in your posts.
  2. To get them to show up in your posts though, you need to add another line of code to your loop.php file:
    <?php the_post_thumbnail(); ?>
    Put this where you want them to sit within the flow.
  3. You can set the appearance and styling by adding your own version of code to the style.css file:
    .attachment-post-thumbnail { width:271px; height:183px; padding: 0 20px 10px 0; float:left; border: 1px solid #e7e7e7; }

That’s it!

other page

What do you think?

It's good to talk!

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