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.

Upgraded to 3.2 from 3.1 and lost the featured image panel in admin that was running in a custom post type.

add_action( 'init', 'create_my_post_types' );

function create_my_post_types() {
    register_post_type( 'header_image_gallery',
        array(
            'labels' => array(
            'name' => __( 'Header Images' ),
            'singular_name' => __( 'Header Image' ),
            'add_new' => __( 'Add New' ),
            'add_new_item' => __( 'Add New Header Image' ),
            'edit' => __( 'Edit' ),
            'edit_item' => __( 'Edit Header Image' ),
            'new_item' => __( 'New Header Image' ),
            'view' => __( 'View Header Images' ),
            'view_item' => __( 'View Header Images' ),
            'search_items' => __( 'Search Header Images' ),
            'not_found' => __( 'No Header Images found' ),
            'not_found_in_trash' => __( 'No Header Images found in Trash' ),
            'parent' => __( 'Parent Header Images' ),
            ),
            'public' => true,
            'supports' => array('title','thumbnail','revisions')
        )
    );
}

Post thumbnails are registered like so:

// This theme uses post thumbnails
    add_theme_support( 'post-thumbnails', array('post', 'page') );

Note: The custom posts that were created prior to upgrade work properly on the frontend showing their post thumbnails (just the featured image admin panel is missing).

Also: I've gone to the codex and pulled the example custom post type, you'll notice it should show a featured image > but also does not.

add_action('init', 'codex_custom_init');
function codex_custom_init() 
{
  $labels = array(
    'name' => _x('Books', 'post type general name'),
    'singular_name' => _x('Book', 'post type singular name'),
    'add_new' => _x('Add New', 'book'),
    'add_new_item' => __('Add New Book'),
    'edit_item' => __('Edit Book'),
    'new_item' => __('New Book'),
    'all_items' => __('All Books'),
    'view_item' => __('View Book'),
    'search_items' => __('Search Books'),
    'not_found' =>  __('No books found'),
    'not_found_in_trash' => __('No books found in Trash'), 
    'parent_item_colon' => '',
    'menu_name' => 'Books'

  );
  $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'post',
    'has_archive' => true, 
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array('title','editor','author','thumbnail','excerpt','comments')
  ); 
  register_post_type('book',$args);
}

If I examine the screen options no featured image option is visible in either example.

* Answered my own question

Perhaps in WP 3.1 you did not have to declare your custom post type when adding theme support but in WP 3.2 you do!

// This theme uses post thumbnails
    add_theme_support( 'post-thumbnails', array('post', 'page','header_image_gallery') );
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Change this:

// This theme uses post thumbnails
add_theme_support( 'post-thumbnails', array('post', 'page') );

To this:

// This theme uses post thumbnails
add_theme_support( 'post-thumbnails' );

The problem is that the array is explicit, when used. So, post-thumbnail support will only be added to post-types included in the array.

Omit the array, in order to add Theme support for post thumbnails universally.

share|improve this answer
    
Ahh ...... duh. –  Devise Oct 13 '11 at 19:33
1  
So, I've tried doing that also, but for some reason, I can't seem to get the featured image area to show up on my custom post type admin area. I'm not totally sure what's going on... On a side note, and totally unrelated to this post, I'm sorry for replying to this thread as an answer as I can't seem to find "comment". –  Brian Feb 11 '12 at 3:49
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.