0
我使用一分钱拍卖wordpress主题,因为我是新的WordPress的。我的问题是通过使用子主题添加更多的字段在侧面元框,所以为此,我已经成功地创建并激活了子主题,但我坚持在这里如何在元框中使用子主题函数添加更多文本字段文件?通过儿童主题自定义元框
我使用一分钱拍卖wordpress主题,因为我是新的WordPress的。我的问题是通过使用子主题添加更多的字段在侧面元框,所以为此,我已经成功地创建并激活了子主题,但我坚持在这里如何在元框中使用子主题函数添加更多文本字段文件?通过儿童主题自定义元框
做到这一点的最简单的方法是安装元框插件(https://wordpress.org/plugins/meta-box/),然后添加到您的子主题的functions.php文件:
function yourprefix_register_meta_boxes($meta_boxes) {
$prefix = 'metaboxprefix_';
$meta_boxes[] = array(
'id' => 'samplefield',
'title' => __('Your Meta Box Title', 'yourtextdomain'),
'post_types' => 'post',
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array(
'name' => __('Your Text Field', 'yourtextdomain'),
'id' => $prefix . 'yourfieldid',
'type' => 'text',
),
)
);
return $meta_boxes;
}
add_filter('rwmb_meta_boxes', 'yourprefix_register_meta_boxes');
以供将来参考:http://metabox.io/