Created
August 26, 2016 17:24
-
-
Save cparkinson/c748e92455bab9f9485f1325eab17502 to your computer and use it in GitHub Desktop.
Code to add custom usermeta field to WC Vendors Pro store settings page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* this is in themes functions.php*/ | |
/******product page blurb***********/ | |
function kindeye_store_product_page_blurb(){ | |
if ( class_exists( 'WCVendors_Pro' ) ){ | |
$key = '_wcv_product_page_vendor_blurb'; | |
$value = get_user_meta( get_current_user_id(), $key, true ); | |
// Product Page blurb | |
WCVendors_Pro_Form_Helper::input( array( | |
'id' => $key, | |
'label' => __( 'Product Page Blurb', 'wcvendors-pro' ), | |
'placeholder' => __( 'Brief description of your brand...', 'wcvendors-pro' ), | |
'desc_tip' => 'true', | |
'description' => __( 'This will appear on each product page.', 'wcvendors-pro' ), | |
'type' => 'text', | |
'value' => $value, | |
) | |
); | |
} | |
} | |
add_action( 'wcvendors_admin_after_commission_due', 'kindeye_store_product_page_blurb_admin' ); | |
function kindeye_store_product_page_blurb_admin( $user ) { | |
?> | |
<tr> | |
<th><label for="_wcv_product_page_vendor_blurb"><?php _e( 'Product Page Blurb', 'wcvendors-pro' ); ?></label></th> | |
<td><input type="text" name="_wcv_product_page_vendor_blurb" id="_wcv_product_page_vendor_blurb" value="<?php echo get_user_meta( $user->ID, '_wcv_product_page_vendor_blurb', true ); ?>" class="regular-text"></td> | |
</tr> | |
<?php | |
} | |
/*********this is in my theme's store-settings.php template *******/ | |
<?php kindeye_store_product_page_blurb( ); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment