Support » Fixing WordPress » post thumbnails not showing

  • Resolved djvirusz


    hi there,

    in the past few days i struggled with this but no success. already checked with the codex and the many tutorials found online 🙁

    my website is this:
    everything works smooth besides the post thumbnails which are not showing.

    my functions.php looks like this…

    if ( function_exists( 'add_theme_support' ) )
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 125, 125 );

    and my header.php tries to show the thumbnails with this code:

    <img src="<?php the_post_thumbnail(); ?>" alt="thumbnail" class="thumbnail" />

    in my panel, under posts, the thumbnails function looks activated and i added a thumbnail for one of the posts (the one that echoes this instead of showing the thumbnail: ” alt=”thumbnail” class=”thumbnail” />)

    any help will be greatly appreciated!


Viewing 7 replies - 1 through 7 (of 7 total)
  • Chris Olbekson


    Level 12 Bug Squasher & Forum Moderator

    You don’t need the <img src="" alt=""/>

    just put <?php the_post_thumbnail(); ?>

    and word press will display the image and add the alt, size, title, and caption if defined.

    thanks! my index.php now looks like this:

    <img src="<?php the_post_thumbnail(); ?>" />

    actually i tried this before but no luck…

    anyone else? 🙂

    Chris Olbekson


    Level 12 Bug Squasher & Forum Moderator

    Change this: <img src="<?php the_post_thumbnail(); ?>" />

    to this: <?php the_post_thumbnail(); ?>

    thanks so much, we did some progress. now it’s showing the thumbnail picture but it ignores the css and alignments.

    i guess the function should be placed somehow under <image> in order for the thumbnail to look nice and for the post summary to show up the way it was designed.

    Chris Olbekson


    Level 12 Bug Squasher & Forum Moderator

    WordPress assigns the following classes to the_post_thumbnail:

    class="attachment-post-thumbnail wp-post-image"

    Or you can assign a div class to the image:
    <div class="thumbnail"><?php the_post_thumbnail(); ?></div>

    To target the default WP classes in your css:

    img.attachment-post-thumbnail {css stuff;}

    this worked as a charm

    <div class="thumbnail"><?php the_post_thumbnail(); ?></div>

    your’re a genius man! forever respect to you!

    I’m running WP 3.1 and also can not get post thumbnails to display at all by editing my custom theme. I’ve read all the tutorials and the codex and inserted all the recommended code in functions.php and my theme. But nothing shows up.

    Further, I’ve seen no explanation of exactly how I’m supposed to know post thumbnails are activated. Will the script automatically grab the first image from the post and place it as a thumbnail on my front page or category pages or archive pages or single pages, depending on where I’ve placed the script?

    Will there be an “insert thumbnail” option in my admin page? That isn’t explained anywhere.

    I’ve been able to get post thumbnails to work one way — by using the thumbnail-for-excerpts plugin. But I want to activate post thumbnails without using a plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘post thumbnails not showing’ is closed to new replies.