在 dokan 中为 Woocommerce 产品集成自定义复选框 [英] Integrate custom checkboxes in dokan for Woocommerce product
本文介绍了在 dokan 中为 Woocommerce 产品集成自定义复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是代码世界的新手,我正在使用带有 Dokan 插件的 Woocommerce.
我将下面的代码添加到添加产品页面,但我需要将此代码作为编辑页面或单个产品页面与 Woocommerce 中的下一个页面集成:
add_action('dokan_new_product_after_product_tags','new_product_field',10);函数 new_product_field(){ ?><div class="dokan-form-group"><div><span>特拉巴霍区</span><br><label><input type="checkbox"value=首都联邦"名称=opcion1"/>首都联邦</label><br><label><input type="checkbox"value=BsAs G.B.A Norte"名称=opcion2";/>BsAs G.B.A Norte</label><br><label><input type="checkbox"值=BsAs G.B.A Oeste"名称=opcion3"/>BsAs G.B.A Oeste</label><br><label><input type="checkbox"值=BsAs G.B.A Sur"名称=opcion4"/>BsAs G.B.A Sur</label><br>
我想知道如何将带有钩子的代码与页面的其余部分集成在一起.
我只有桌子,但它什么都没有.有什么帮助吗?
解决方案
灵感来自这段代码 在 Github 上找到 (来自 @nayemDevs),您会在下面找到您的重新审视了一些附加功能的代码,这些功能应该可以处理您的一些需求(评论):
//额外复选框的字段设置函数 get_work_option_field_settings(){$text_domain = 'dokan-lite';返回数组('名称' =>'工作区','标题' =>__(Zona de trabajo", $text_domain),'字段' =>大批('1' =>__(首都联邦", $text_domain),'2' =>__(BsAs G.B.A Norte", $text_domain),'3' =>__(BsAs G.B.A Oeste", $text_domain),'4' =>__(BsAs G.B.A Sur", $text_domain),),);}//在新产品弹出/无弹出表单上添加额外的字段add_action( 'dokan_new_product_after_product_tags', 'add_dokan_new_product_custom_fields', 10 );函数 add_dokan_new_product_custom_fields(){$settings = get_work_option_field_settings();//加载字段设置$field_id = $settings['name'];//获取自定义字段元键echo '<span class="field-title">'.$settings['title'] .'</span><br>';//循环字段选项设置foreach ( $settings['fields'] as $key => $label ) {echo '