自定义帖子类型不显示精选图像

时间:2015-04-26 21:27:49

标签: wordpress custom-post-type

我无法在编辑器中显示“特色图片”。这是在features.php中。当我转到管理员后端时,结束编辑CPT,我得到没有特色图像的常规编辑屏幕。我认为支持缩略图是要走的路。

function createStyleWiseCPT() {

    $labels = array(
        'name'                => _x( 'Style Wise', 'Post Type General Name', 'text_domain' ),
        'singular_name'       => _x( 'Style Wise', 'Post Type Singular Name', 'text_domain' ),
        'menu_name'           => __( 'Style Wise', 'text_domain' ),
        'name_admin_bar'      => __( 'Style Wise', 'text_domain' ),
        'parent_item_colon'   => __( 'Parent Item:', 'text_domain' ),
        'all_items'           => __( 'All Style Questions', 'text_domain' ),
        'add_new_item'        => __( 'Add New Style Question', 'text_domain' ),
        'add_new'             => __( 'Add New Style Question', 'text_domain' ),
        'new_item'            => __( 'New Style Question', 'text_domain' ),
        'edit_item'           => __( 'Edit Style Question', 'text_domain' ),
        'update_item'         => __( 'Update Style Question', 'text_domain' ),
        'view_item'           => __( 'View Style Question', 'text_domain' ),
        'search_items'        => __( 'Search Style Question', 'text_domain' ),
        'not_found'           => __( ' Style Question Not found', 'text_domain' ),
        'not_found_in_trash'  => __( ' Style Question Not found in Trash', 'text_domain' ),
    );
    $args = array(
        'label'               => __( 'style-wise', 'text_domain' ),
        'description'         => __( 'A styleish post', 'text_domain' ),
        'labels'              => $labels,
        'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ),
        'taxonomies'          => array( 'style-wise' ),
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'menu_position'       => 5,
        'show_in_admin_bar'   => true,
        'show_in_nav_menus'   => true,
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'page',
    );
    register_post_type( 'style-wise', $args );

}

1 个答案:

答案 0 :(得分:1)

尝试在功能中添加此功能

add_theme_support( 'post-thumbnails', array( 'post','custom-post-type-here','another-custom-post-type' ) )

您还可以查看codex for reference