WordPress.org

Ready to get started?Download WordPress

Forums

Multiple Featured Images (3 posts)

  1. bigfatty
    Member
    Posted 1 year ago #

    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(); ?>
    	</div>

    You can see it in action here: http://www.laketahoeweddings.net

    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?
    Thanks.

  2. jimisdon
    Member
    Posted 1 year ago #

    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.

    http://wordpress.org/extend/plugins/multiple-post-thumbnails/installation/

    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.

    http://codex.wordpress.org/Function_Reference/add_image_size

  3. bigfatty
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic