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



我无法让"特色图片"显示在编辑器中。这是功能.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 );
}

尝试在函数中添加它

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

您也可以查看法典以供参考

最新更新