代码之家  ›  专栏  ›  技术社区  ›  Drew LeSueur

在wordpress3.0中,如何获得自定义Post类型的默认自定义字段UI?

  •  0
  • Drew LeSueur  · 技术社区  · 15 年前

    如何获得自定义post类型的默认自定义字段UI?

    1 回复  |  直到 15 年前
        1
  •  0
  •   Drew LeSueur    15 年前

    你要做的就是 custom-field supports 部分。

    register_post_type( 'location',
        array(
          'labels' => array(
            'name' => __( 'Locations' ),
            'singular_name' => __( 'Location' )
          ),
          'public' => true,
          'show_ui' => true,
          'supports' => array('title',
                    'editor',
                    'thumbnail',
                    'excerpt',
                    'custom-fields'
                ),
          'rewrite' => array('slug' => 'locations')
        )
      );