¿Por qué no aparece la imagen destacada en mi tipo de publicación personalizada?

26

Se agregó soporte para miniaturas con lo siguiente en mi functions.php

// Add Thumbnail Support
add_theme_support('post-thumbnails');
set_post_thumbnail_size( 140, 140, true );

Y creo el tipo de publicación personalizada con

// Create Custom Post Type for Work
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'custom_post',
    array(
        'thumbnail',
        'labels' => array(
            'name' => __( 'Custom' ),
            'singular_name' => __( 'Custom' )
        ),
        'public' => true,
        'has_archive' => true,
        'rewrite' => array('slug' => 'custom'),
        'taxonomies' => array('category', 'post_tag')
    )
  );
}

Sin embargo, cuando creo una nueva publicación en el Tipo de publicación personalizada, no se muestra el cuadro de meta Imagen destacada. También he intentado usar una matriz al declarar el tipo de publicación personalizada, como sigue, pero tampoco funcionó

// Add Thumbnail Support
add_theme_support('post-thumbnails', array ('post','work','custom_post'));
set_post_thumbnail_size( 140, 140, true );

¿Qué me estoy perdiendo?

    
pregunta Ryan 11.05.2012 - 18:01

3 respuestas

44

pruebe el register_post_type supports parámetro:

'supports' => array( 'thumbnail' )
    
respondido por el Milo 11.05.2012 - 18:05
7

Agregue este parámetro a su matriz:

'supports' => array('thumbnail'),

Editar: Milo fue más rápido.

    
respondido por el kevin 11.05.2012 - 18:10
2

Intenta esto, me funciona ...

add_theme_support('post-thumbnails');
add_post_type_support( 'my_product', 'thumbnail' );    
function create_post_type() {
        register_post_type( 'my_product',
            array(
                'labels' => array(
                    'name' => __( 'Products' ),
                    'singular_name' => __( 'Product' )
                ),
                'public' => true,
                'has_archive' => true
            )
        );
    }
    add_action( 'init', 'create_post_type' );
    
respondido por el Muhammad Sadiq 08.12.2015 - 10:55

Lea otras preguntas en las etiquetas