admin管理员组文章数量:1122832
Now I am building a wordpress plugin. I need to add a metabox to the admin submenu page. I tried like this below,
add_action( 'add_meta_boxes', 'add_meta_boxs');
function add_meta_boxs()
{
add_meta_box( 'my-meta-box-id', 'My First Meta Box', 'meta_box', 'myContactForm', 'normal', 'high' );
}
I created a submenu page:
add_submenu_page( 'myForm', 'Add New' , 'Add New', 'manage_options', 'newForm', 'newform_page');
function newform_page()
{
<div class="form-container-2">
<?php do_meta_boxes('myContactForm', 'normal', null); ?>
</div>
}
Here "myContactForm" is a custom post type. Meta box was created in custom post type but what I need is meta box will be created within submenu page.
Anyone help me please.
Now I am building a wordpress plugin. I need to add a metabox to the admin submenu page. I tried like this below,
add_action( 'add_meta_boxes', 'add_meta_boxs');
function add_meta_boxs()
{
add_meta_box( 'my-meta-box-id', 'My First Meta Box', 'meta_box', 'myContactForm', 'normal', 'high' );
}
I created a submenu page:
add_submenu_page( 'myForm', 'Add New' , 'Add New', 'manage_options', 'newForm', 'newform_page');
function newform_page()
{
<div class="form-container-2">
<?php do_meta_boxes('myContactForm', 'normal', null); ?>
</div>
}
Here "myContactForm" is a custom post type. Meta box was created in custom post type but what I need is meta box will be created within submenu page.
Anyone help me please.
Share Improve this question edited Apr 18, 2017 at 10:35 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Apr 10, 2017 at 10:23 PreethiPreethi 137 bronze badges1 Answer
Reset to default 0Meta box are designed to work with Post(s) and Custom post types.
However you can make it work on options page if you know what you are doing.
Click here for sample code
本文标签: Adding metabox to wordpress plugins menu page
版权声明:本文标题:Adding metabox to wordpress plugins menu page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736292498a1928947.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论