Created
April 24, 2012 15:53
-
-
Save baczoni/2480946 to your computer and use it in GitHub Desktop.
Wordpress: Enable featured image for posts/pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_theme_support( 'post-thumbnails' ); | |
// This adds support for pages only: | |
add_theme_support( 'post-thumbnails', array( 'page' ) ); | |
// And this adds support for posts only: | |
add_theme_support( 'post-thumbnails', array( 'post' ) ); | |
// To get the thumbnail in your post, you add the following inside the loop: | |
if ( has_post_thumbnail() ) { | |
set_post_thumbnail_size( 400, 150 ); # width, height # | |
the_post_thumbnail(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment