Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type set up with the following in my functions.php. The problem is that the post thumbnail box doesn't show up in the dashboard in the "Talent" section even after I specified 'supports' => array('title','editor','thumbnail'),. Is there something I'm missing?

add_theme_support( 'post-thumbnails', array( 'post' ) );

// Register Talents
add_action('init', 'register_talents');

function register_talents() {

    $labels = array(
        'name' => _x('Talents', 'post type general name'),
        'singular_name' => _x('Talent', 'post type singular name'),
        'add_new' => _x('Add New', 'talent item'),
        'add_new_item' => __('Add New Talent'),
        'edit_item' => __('Edit Talent'),
        'new_item' => __('New Talent'),
        'view_item' => __('View Talent'),
        'search_items' => __('Search Talents'),
        'not_found' =>  __('Nothing found'),
        'not_found_in_trash' => __('Nothing found in Trash'),
        'parent_item_colon' => ''
    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'menu_icon' => get_stylesheet_directory_uri() . '/images/menu-talents.png',
        'supports' => array('title','editor','thumbnail'),
        'has_archive' => true
      );

    register_post_type( 'talents' , $args );
}
share|improve this question
add comment

2 Answers

Try changing this:

add_theme_support( 'post-thumbnails', array( 'post' ) );

to this:

add_theme_support( 'post-thumbnails' );

IIRC, that array is explicit, meaning that by including only post, everything else is excluded. But if you omit the array, then post-thumbnail support is added for all post-types that support them.

share|improve this answer
add comment

This should work...

add_theme_support('post-thumbnails', array('talents'));

Where 'talents' is your custom post type. I've noticed that many a times for a couple of functions and hooks in WP, you need to replace 'post'/'posts' by the custom post type's name in order to make it work with custom posts. For e. g. If you're to use 'publish_post' with 'talents', you'd have to use 'publish_talents'.

Read this: http://codex.wordpress.org/Function_Reference/add_theme_support Look for the example for adding thumbnail support for 'movie' type custom post.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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