This is a twentytwelve wordpress child theme, and it's located at www.travelwithcastle.com

I'd very much like to delete the enormous preview pic that shows up on top of the actual post page. It's the feature pic I chose to be the preview pic for the homepage. I love the picture, but that picture is already within the post content, so there is no need for it appear above the post as well.

I took at look at content.php, thinking that would be the place to look, but I'm a little stumped. Perhaps I'm misunderstanding the code, but it seems to me that any change I make there will also affect the actual preview of the post on the homepage. I thought I was removing the image for example by deleting the thumbnail, but that removed the image completely from the homepage preview. Can anyone explain how I can instruct the site to not show the preview pic at the top of the post, while keeping it on the homepage as a preview? Perhaps I need to structure the files differently?

to be clear, the picture i choose as the featured image for the post (the one that shows up on the homepage preview) also shows up at the top of the actual post, before the title. I'd like it not to be there since it's already in the post content.

I did peruse your past questions, and while a lot of very similar questions are asked, this one is not.

Many thanks.


content.php is posted here for your reference:

 * The default template for displaying content. Used for both single and index/archive/search.
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
        <div class="featured-post">
            <?php _e( 'Featured post', 'twentytwelve' ); ?>
        <?php endif; ?>
        <header class="entry-header">
            <?php the_post_thumbnail(); ?>
            <?php if ( is_single() ) : ?>
            <h1 class="entry-title"><?php the_title(); ?></h1>
            <?php else : ?>
            <h1 class="entry-title">
                <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a> <br><?php the_date(); ?>
            <?php endif; // is_single() ?>
            <?php if ( comments_open() ) : ?>
                <div class="comments-link">
                    <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
                </div><!-- .comments-link -->
            <?php endif; // comments_open() ?>
        </header><!-- .entry-header -->

<?php if ( is_search() || is_home() ) : // Display Excerpts for Search and Homepage ?>

        <?php else : ?>
        <div class="entry-content">
            <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
            <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
        </div><!-- .entry-content -->
        <?php endif; ?>

            <?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>
                <div class="author-info">
                    <div class="author-avatar">
                        <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ) ); ?>
                    </div><!-- .author-avatar -->
                    <div class="author-description">
                        <h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2>
                        <p><?php the_author_meta( 'description' ); ?></p>
                        <div class="author-link">
                            <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
                                <?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentytwelve' ), get_the_author() ); ?>
                        </div><!-- .author-link -->
                    </div><!-- .author-description -->
                </div><!-- .author-info -->
            <?php endif; ?>
        </footer><!-- .entry-meta -->
    </article><!-- #post -->

3 Answers 3


This will work:

<?php if ( is_home() ) : ?>
<?php the_post_thumbnail(); ?>
<?php endif; ?>

This code will only show your feature image on homepage and not in post page.


Remove the_post_thumbnail(); and this won't show up.

  • It seems to me like the OP wants the thumbnail to show up under some difficult-to-determine conditions but not others.
    – s_ha_dum
    Commented Aug 26, 2013 at 20:34
  • Ya, I'm not very familiar with twentytwelve unfortunately. Seems it is another of those really strange "1 template does the job of 20 and/or 20 templates do the job of 1" themes. I believe Daniel has the more correct answer.
    – GhostToast
    Commented Aug 26, 2013 at 20:35
  • thanks, all. daniel's answer worked. the conditions i needed were: thumbnail appears only on the homepage. not on the actual post page.
    – kelly
    Commented Aug 27, 2013 at 15:23

Install functionality plugin because you have to seperate this code from theme( in future if theme update you lost this functionality if you paste this code in functions.php ).

From Plugin Description:

A functionality plugin is a way to separate what you might normally place in a theme's functions.php file, and put it in a plugin instead. It works the same way as a theme functions.php file, but is separate from the theme and so not affected by theme upgrades, or tied to the theme so you loose all of your functions if you choose to switch themes.

This plugin automates the process of creating a functionality plugin. Simply install and activate this plugin, and your very own functionality plugin will be created for you. You can then edit your functionality plugin and add snippets to it using the quick link in the admin menu.

add_filter( 'post_thumbnail_html', 'ravs_hide_featured_image_on_post', 10, 5 );
function ravs_hide_featured_image_on_post( $html, $post_id, $post_thumbnail_id, $size, $attr ){

    if( is_single() )
        $html =''; // hide featured image in post
    return $html;



you don't have to edit you theme template code just try this code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.