【发布时间】:2013-11-08 23:15:10
【问题描述】:
我正在使用 WordPress'Custom Metadata Plugin 将元数据组添加到我正在开发的网站。
我想做的是添加一个自定义字段,可以根据需要添加更多自定义字段,例如:
但是当我发布帖子时,它会打乱输入顺序,如下所示:
这是我的代码。多个字段在x_add_metadata_field 函数的底部创建,multiple=> true。
function myfunction_x_init_cw_fields(){
if( function_exists( 'x_add_metadata_field' ) && function_exists( 'x_add_metadata_group' ) ) {
$post_types = array( 'page' );
$args = array(
'label' => 'Include Content Widgets', // Label for the group
'context' => 'normal', // (post only)
'priority' => 'default', // (post only)
'autosave' => false //, // (post only) Should the group be saved in autosave? NOT IMPLEMENTED YET!
//'exclude' => '', // posts#s to exclude
//'include' => '', // posts#s to include
);
x_add_metadata_group( 'myfunction_cw_details', $post_types, $args );
x_add_metadata_field( 'myfunction_page_cw_field', $post_types, array(
'group' => 'myfunction_cw_details', // the group name
'description' => esc_html('Enter content widget slug under "content widgets"'),
'label' => 'Content Widget Slugs',
'multiple' => true
));
}
}
add_action( 'custom_metadata_manager_init_metadata', 'myfunction_x_init_cw_fields' );
基本上,我希望有人会说“嘿,文档中没有提到的结果排序设置。”
【问题讨论】:
标签: php wordpress plugins metadata field