Skip to content

Instantly share code, notes, and snippets.

@fervous
Forked from bentasm1/functions.php
Created September 3, 2016 04:17
Show Gist options
  • Save fervous/e2f96a662d2be2691064d8655471240f to your computer and use it in GitHub Desktop.
Save fervous/e2f96a662d2be2691064d8655471240f to your computer and use it in GitHub Desktop.
WC Vendors Pro - Add another file uploader to the add/edit product form
/* WC Vendors Pro - Add another file uploader to upload a file with the ID in a meta key */
function custom_wcv_file_uploader( ){
$value = get_user_meta( get_current_user_id(), 'wcv_custom_product_file1', true ); // Must match meta key used in line 8
WCVendors_Pro_Form_Helper::file_uploader( array(
'header_text' => __('File uploader', 'wcvendors-pro' ),
'add_text' => __('Add file', 'wcvendors-pro' ),
'remove_text' => __('Remove file', 'wcvendors-pro' ),
'image_meta_key' => 'wcv_custom_product_file1', // Must match meta key used in line 3
'save_button' => __('Add file', 'wcvendors-pro' ),
'window_title' => __('Select an Image', 'wcvendors-pro' ),
'value' => $value
)
);
}
// call this function in your product-edit.php template
<?php
custom_wcv_file_uploader();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment