snakespan
snakespan

Reputation: 1211

Featured Image Not Showing in Wordpress

I'm trying to show a featured image in Wordpress, I've uploaded the image (put it as the smallest image possible) but when I view the blog list view (category.php) I just get the blog post header, and no image.

Anybody know how to show the image? Checked the source, and doesn't show an image at all.

Hope someone can help, would be much appreciated.

Upvotes: 1

Views: 3533

Answers (1)

Patrick Moore
Patrick Moore

Reputation: 13344

In addition to setting the featured image in WP admin, you need rendering code somewhere in your template files. Something like this:

if ( has_post_thumbnail( get_the_ID() ) ) {
    echo get_the_post_thumbnail( get_the_ID() );
}

I use this code in my header.php theme file, but you may prefer it within page.php or elsewhere (category.php seems appropriate in your case).

Check the documentation for help changing the dimensions, adding class attributes, etc. to the <img/> tag generated.

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

Upvotes: 1

Related Questions