小编Ach*_*ngh的帖子

Dokan 插件定制

我正在为多供应商网站使用 dokan 插件。我想在 dokan 供应商设置页面中添加一些额外的字段。我用这个

add_filter( 'dokan_settings_form_bottom', 'extra_fields', 10, 2);


function extra_fields( $current_user, $profile_info ){


$seller_url= isset( $profile_info['seller_url'] ) ? 
$profile_info['seller_url'] : '';?>
Run Code Online (Sandbox Code Playgroud)

    <label class="dokan-w3 dokan-control-label" for="setting_address">

        <?php _e( 'Website', 'dokan' ); ?>

    </label>

    <div class="dokan-w5">

        <input type="text" class="dokan-form-control input-md valid" name="seller_url" id="reg_seller_url" value="<?php echo $seller_url; ?>" />

    </div>

</div>



<?php }
//save the field value


add_action( 'dokan_store_profile_saved', 'save_extra_fields', 15 );

function save_extra_fields( $store_id ) {

if ( isset( $_POST['seller_url'] ) ) {

    $dokan_settings = dokan_get_store_info($store_id);

    $dokan_settings['seller_url'] = $_POST['seller_url'];

} …
Run Code Online (Sandbox Code Playgroud)

wordpress dokan

1
推荐指数
1
解决办法
829
查看次数

标签 统计

dokan ×1

wordpress ×1