Wordpress Post Thumbnail metabox not appearing
WordPress version : 3.1 post thumbnail field not appearing in editor section except for Page editor . My Code inside function.php
add_theme_support( 'post-thumbnails', array( 'post' ) ); // Add it for posts开发者_如何学C
add_theme_support( 'post-thumbnails', array( 'slider' ) ); //For Slider Image
add_theme_support( 'post-thumbnails', array( 'portfolio' ) ); //For Portfolio
add_theme_support( 'post-thumbnails', array( 'book' ) ); //For Book
add_theme_support( 'post-thumbnails', array( 'page' ) ); // Add it for pages
As I understand it,
1. add_theme_support( 'post-thumbnails' );
2. set_post_thumbnail_size( 150, 150 );
3. add_image_size( 'portfolio', 275, 152 );
First function adds the support.
Second changes the size of the thumbnail, there is resize mode like above or hard crop like this,
set_post_thumbnail_size( 150, 150, true);
Which will not resize just crop.
Thirdly is a custom size set for a certain tag of posts, so for the portfolio tag the thumbnail would be 272, 152, box resize mode.
Each call to add_theme_support for 'post-thumbnails' replaces the previous settings. You need to use
add_theme_support('post-thumbnails', array('post', 'page', 'slider', 'portfolio', 'book') );
Personally - IMHO when you create your custom post types - adding the "post-thumbnails" to the support argument when you register the post_type.
精彩评论