0

因此,我正在尝试对 Wordpress 中的管理仪表板进行一些自定义(版本 4.9.1 前沿)。我正在一个插件中创建一个自定义帖子,我将为出价和显示广告列表帖子而开发。register_post_type 函数设置是相当标准的,如下(去除任何多余的要求):

function tp_register_advert_post_type() {

  $singular = 'Ad Listing';
  $plural = 'Ad Listings';

  $labels = array(
    'name' => $plural,
    'singular_name'       => $singular,
    'add_name'            => 'Add New',
    'add_new_item'        => 'Add New ' . $singular,
    'edit'                => 'Edit',
    'edit_item'           => 'Edit ' . $singular,
    'new_item'            => 'New ' . $singular,
    'view'                => 'View',
    'view_item'           => 'View ' . $singular,
    'search_item'         => 'Search ' . $plural,
    'parent'              => 'Parent ' . $singular,
    'not_found'           => 'No ' . $plural .' found',
    'not_found_in_trash'  => 'No ' . $plural .' in Trash'
  );

  $args = array(
    'labels'              => $labels,
    'capability_type'     => 'post',
    'public'              => true,
    'publicly_queryable'  => true,
    'has_archive'         => true,
    'exclude_from_search' => false,
    'show_ui'             => true,
    'show_in_menu'        => true,
    'show_in_admin_bar'   => true,
    'menu_position'       => 6,
    'menu-icon'           => 'dashicons-vault',
    'can_export'          => true,
  );

  register_post_type( 'ad listing', $args );
}
add_action( 'init', 'tp_register_advert_post_type' );

除了 $args 数组中的 menu_icon 之外,一切正常吗?我到底做错了什么?我看不到任何明显的东西 - 除了默认的“pin”图标仍在显示之外,其他一切都正常吗?帮助?

4

1 回答 1

0

看来您的索引$argsmenu-icon,但它应该menu_icon根据Codex

于 2017-12-20T00:38:48.147 回答