Support » Fixing WordPress » Multiple Featured Images

  • I know there is a plugin that allows for two featured images on a page, but I thought there might be a simple way to hard code my Twenty Ten theme to add to what I’ve already started. I wanted 5 excerpts of my most recent posts along with a 150 x 150 thumbnail to appear on my static home page. I accomplished this by adding the code below to my page.php file and using the “Set Featured Image” option:

    <div id="frontpagepostpull">
    <?php $temp_query = $wp_query; ?>
    <?php query_posts('showposts=5'); ?>
    <?php while (have_posts()) : the_post(); ?>
    	<div class="post" id="post-<?php the_ID(); ?>">
    	<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <?php the_post_thumbnail('front-page-post-thumbnail'); ?>  <?php the_excerpt(); ?>

    You can see it in action here:

    I would also like a custom 940 x 198 header for each post, but I already used the “Set Featured Image” for the 150 x 150 thumbnail. Is there any advice on how to do this that isn’t to complicated?

Viewing 2 replies - 1 through 2 (of 2 total)
  • If it’s a custom for each post, then you’re going to want to use the Multiple Post Thumbnails plugin. You’ll still end up calling the images in your template files. It is honestly the best way to do what you want, unless you want to get into REGEX. And you probably don’t.

    It’s not a turn key plugin, though. It has no user interface. You’ll have to add some code to your functions file and to your theme to actually get it to produce anything.

    You may want to look into the add_image_size() function as well, unless you are already going to make sure all those images are cropped to exact size before you upload them. If so, you can just have the plugin fetch the full size image.

    Thank you for the response. If I use the plugin, does the code I already have inserted into the page.php file (shown above) remain as it is since each of the 150 x 150 thumbnails are appearing on the home page as planned and simply use the plugin to call the 940 x 198 custom headers to each individual post? I wasn’t sure how all this works so I just want to make sure nothing conflicts.
    Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multiple Featured Images’ is closed to new replies.