我正在构建一个类似于Woocommerce的插件,唯一的区别是它只会添加产品而不会添加其他功能。我已经构建了一个包含7个选项卡的元框。将根据从投递箱中选择的值显示和隐藏。现在我的问题是如何用标签的每个值保存整个元框?这是我的Meta框代码:
`add_action('add_meta_boxes', 'add_product_fields_box');
function add_product_fields_box() {
add_meta_box('product-data', 'Product Data', 'display_product_info_box', 'cproduct', 'normal');}
function display_product_info_box() {
//echo "This is Meta Box 1";?>
<div>
<h2>Product Data ----
<select id="producttype">
<optgroup label="Product Type">
<!--<option value="0"><b>Product Type</b></option>-->
<option value="1" selected>Simple Product</option>
<option value="2">Grouped Product</option>
<option value="3">External/Affiliate Product</option>
<option value="4">Variable Product</option>
</optgroup>
</select>
<span>|</span>
<span id="virtual">Virtual <input type="checkbox" id="virchk" name="virtual"></span>
<span id="download">Downloadable <input type="checkbox" id="dowchk" name="download"></span>
</h2>
</div>
<div id="acme-navigation">
<h2 class="nav-tab-wrapper current">
<a id="tabgeneral" class="nav-tab nav-tab-active" href="#acme-general">General</a>
<a id="tabinventory" class="nav-tab" href="#acme-inventory">Inventory</a>
<a id="tabshipping" class="nav-tab" href="#acme-shipping">Shipping</a>
<a id="tablinked" class="nav-tab" href="#acme-linked-products">Linked Products</a>
<a id="tabattribute" class="nav-tab" href="#acme-attributes">Attributes</a>
<a id="tabvariation" class="nav-tab" href="#acme-attributes">Variations</a>
<a id="tabadvance" class="nav-tab" href="#acme-advanced">Advanced</a>
</h2>
</div>
<?php include_once( 'partials/general.php' ); ?>
<?php include_once( 'partials/inventory.php' ); ?>
<?php include_once( 'partials/shipping.php' ); ?>
<?php include_once( 'partials/linked-products.php' ); ?>
<?php include_once( 'partials/attributes.php' ); ?>
<?php include_once( 'partials/variations.php' ); ?>
<?php include_once( 'partials/advanced.php' ); ?>
<div id="custom-meta-box-nonce" class="hidden">
<?php echo wp_create_nonce( 'acme-custom-meta-box-nonce' ); ?>
</div>
<br/> <?php
//include('Data/Views/first.php');}`
请帮我写保存功能,因为我不知道从哪里开始。