Skip to content

Instantly share code, notes, and snippets.

@digitalchild
Created February 5, 2016 04:36
Show Gist options
  • Save digitalchild/322bec1401d68810907d to your computer and use it in GitHub Desktop.
Save digitalchild/322bec1401d68810907d to your computer and use it in GitHub Desktop.
Custom Fields to Shop Settings Page
function store_bank_details( ){
if ( class_exists( 'WCVendors_Pro' ) ){
$key = '_wcv_custom_settings_bankname';
$value = get_user_meta( get_current_user_id(), $key, true );
// Bank Name
WCVendors_Pro_Form_Helper::input( array(
'id' => $key,
'label' => __( 'Bank Name', 'wcvendors-pro' ),
'placeholder' => __( 'First Bank', 'wcvendors-pro' ),
'desc_tip' => 'true',
'description' => __( 'Your local bank name', 'wcvendors-pro' ),
'type' => 'text',
'value' => $value,
)
);
}
}
// This will add the custom field to the user edit screen
add_action( 'wcvendors_admin_after_commission_due', 'wcv_store_bank_details_admin' );
function wcv_store_bank_details_admin( $user ) {
?>
<tr>
<th><label for="_wcv_custom_settings_bankname"><?php _e( 'Bank Name', 'wcvendors-pro' ); ?></label></th>
<td><input type="text" name="_wcv_custom_settings_bankname" id="_wcv_custom_settings_bankname" value="<?php echo get_user_meta( $user->ID, '_wcv_custom_settings_bankname', true ); ?>" class="regular-text"></td>
</tr>
<?php
}
?>
<?php // Add the following on the store-settings.php template ?>
<?php store_bank_details( ); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment