WordPress将图像添加到分类演员 [英] wordpress add an image to a taxonomy actor

查看:71
本文介绍了WordPress将图像添加到分类演员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将图像添加到自定义分类法角色中,但是当我在edit actor选项中查看时,它仅显示选项名称slug&描述。
对于上述问题,我需要在functions.php中添加一个选项。

I was wanting to add a image to my custom taxonomy actor, but when I look in the edit actor options it only shows the options name, slug & description. I need to add an option in the functions.php for the above mentioned problem.

////////////////////////////////////
//         TAXONOMY ACTORS        //
////////////////////////////////////

register_taxonomy(
    'actor',
    array( 'movies' ),
    array(
        'labels'            => array(
        'name'              => __( 'Actors' ),
        'singular_name'     => __( 'Actor' ),
        'search_items'      => __( 'Search Actors' ),
        'all_items'         => __( 'All Actors' ),
        'parent_item'       => __( 'Parent Actor' ),
        'parent_item_colon' => __( 'Parent Actor:' ),
        'view_item'         => __( 'View Actor' ),
        'edit_item'         => __( 'Edit Actor' ),
        'update_item'       => __( 'Update Actor' ),
        'add_new_item'      => __( 'Add New Actor' ),
        'new_item_name'     => __( 'New Actor Name' ),
        'menu_name'         => __( 'Actor' ),
        ),
        'hierarchical'      => false,
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        'rewrite'           => array( 'slug' => 'actor' ),
    )
);

我试图在不询问的情况下找到实现该目标的方法,因此感谢您的帮助。 / p>

I have tried to find out how I would achieve this without asking here, so any help appreciated.

推荐答案

尝试添加 supports 参数:

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

例如:

...
        'hierarchical'      => false,
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        'rewrite'           => array( 'slug' => 'actor' ),
        'supports'          => array( 'thumbnail' ),
    )
);

有关详细信息,请参见步骤5:函数实现 href = https://code.tutsplus.com/tutorials/a-guide-to-wordpress-custom-post-types-creation-display-and-meta-boxes--wp-27645 rel = nofollow noreferrer >本指南

For details, see "Step 5: Function Implementation" in this guide:


'supports'=> array('title','editor','comments','thumbnail','custom-fields')确定要显示的自定义帖子类型的功能。

'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'custom-fields' ) determines the features of the custom post type which is to be displayed.

这篇关于WordPress将图像添加到分类演员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆