我正在创建一个小插件,有麻烦找出如何在我的设置页面中创建多个类别的 Select .我使用这样的多产品 Select ,它将 Select 的值保存到Options表中:
<select class="wc-product-search" multiple="multiple" style="width: 50%;" id="namedayemail_options[exclude_prods]" name="namedayemail_options[exclude_prods][]" data-placeholder="<?php esc_attr_e( 'Search for a product…', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations" >
<?php
if (isset($options['exclude_prods'])) {
$ex_product_ids = $options['exclude_prods'];
foreach ( $ex_product_ids as $product_id ) {
$product = wc_get_product( $product_id );
if ( is_object( $product ) ) {
echo '<option value="' . esc_attr( $product_id ) . '"' . selected( true, true, false ) . '>' . wp_kses_post( $product->get_formatted_name() ) . '</option>';
}
}
}
?>
</select>
我正在寻找类似的产品类别的解决方案.
I am sure LoicTheAztec will know the solution. Thanks ahead.:-)