【发布时间】:2016-12-02 09:34:51
【问题描述】:
我创建了一个自定义帖子类型调用'电影'。现在,我想在此调用中添加自定义元字段Movie Reviews。我有以下自定义帖子类型的代码。
function Create_Movies_Posttype()
{
register_post_type('Movies',
array(
'labels'=>array('name'=>__('Movies'),'singular_name'=>__('Movie')),
'public'=>true,
'has_archive'=>true,
'rewrite'=>array('slug'=>'movies'),
'support'=>array('title','custom-fields','edit'),
)
);
}
add_action('init','Create_Movies_Posttype');
添加了元框
function adding_custom_meta_boxes( $post ) {
add_meta_box(
'my-meta-box',
__( 'My Meta Box' ),
'render_my_meta_box',
'post',
'normal',
'default'
);
}
add_action( 'add_meta_boxes_post', 'adding_custom_meta_boxes' );
请任何人帮我解决这个自定义字段。
【问题讨论】:
标签: wordpress wordpress-theming