WordPress.org

Ready to get started?Download WordPress

Forums

Two Featured Images (4 posts)

  1. bigfatty
    Member
    Posted 1 year ago #

    Is there a way two have two featured images using the featured image link on any given post page, one for a custom page header and one for a thumbnail for my home static page where excerpts from my 5 recent posts appear? When I click the featured image link from a post page and upload a 940 x 198 image (header size of Twenty Ten), my custom header automatically appears at the top of the page. If I upload a 150 x 150 post related photo using the featured image link, a thumbnail appears on my static home page next to an excerpt from the post page (I used the code below in the page.php file in my child theme to accomplish this):

    <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>
    <?php endwhile; ?>
    </div>

    Thumbnails appear here: http://www.laketahoeweddings.net , but I also want a different header on the actual post page. But, I cannot figure it out. I can have one or the other, but I'm sure there's a way to have both images appear. Any help would be appreciated.

    Kenny

  2. David Choi
    Member
    Posted 1 year ago #

  3. bigfatty
    Member
    Posted 1 year ago #

    Thanks for the reply. However, I'm a little lost on how to install the plugin. Can you tell me:

    1. Where in the functions.php file should the plugin code be added? At the top of the file, bottom, or does it matter?

    if (class_exists('MultiPostThumbnails')) {
            new MultiPostThumbnails(
                array(
                    'label' => 'Secondary Image',
                    'id' => 'secondary-image',
                    'post_type' => 'post'
                )
            );
        }

    2. Should it be wrapped within <?php ?> tags?
    3. Should a copy of the functions.php file with this modification be placed in a child theme?

    Also:

    4. If I want the secondary image as the post's 940 x 198 header, should I place this code in the header.php file?

    <?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image'); endif; ?>

    Thanks for any help.

  4. David Choi
    Member
    Posted 1 year ago #

    I didn't use this plugin personally, but you can get the plugin support at

    http://wordpress.org/support/plugin/multiple-featured-images

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.