0

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 );
}

2 Answers 2

1

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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