如何为自定义推荐帖子类型添加特色图片支持

时间:2019-03-29 12:44:31

标签: php wordpress wordpress-theming

我正在创建个人鉴定自定义帖子类型。但是我并没有获得同样的图像支持。我还在register_post_type()函数中提供了支持。以下是我的代码: 我在此上方调用添加主题支持功能

我正在用WordPress创建自定义主题。

add_action( 'init', 'testimonials_post_type' );
function testimonials_post_type() {
    $labels = array(
        'name' => 'Testimonials',
        'singular_name' => 'Testimonial',
        'add_new' => 'Add New',
        'add_new_item' => 'Add New Testimonial',
        'edit_item' => 'Edit Testimonial',
        'new_item' => 'New Testimonial',
        'view_item' => 'View Testimonial',
        'search_items' => 'Search Testimonials',
        'not_found' =>  'No Testimonials found',
        'not_found_in_trash' => 'No Testimonials in the trash',
        'parent_item_colon' => '',
    );
 register_post_type( 'testimonials', array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'exclude_from_search' => true,
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'has_archive' => true,
        'hierarchical' => false,
        'menu_position' => 10,
        'supports' => array( 'editor','thumbnail' ),
        'register_meta_box_cb' => 'testimonials_meta_boxes',
    ) );
}

0 个答案:

没有答案