Skip to content

Instantly share code, notes, and snippets.

@digitalchild
Last active July 5, 2018 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save digitalchild/86e3b64cbad92dc16e15 to your computer and use it in GitHub Desktop.
Save digitalchild/86e3b64cbad92dc16e15 to your computer and use it in GitHub Desktop.
File uploader
<?php
// Add this to your themes functions file
function wcv_file_uploader( ){
$value = get_user_meta( get_current_user_id(), 'YOURMETAKEYHERE', true );
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' => 'YOURMETAKEYHERE',
'save_button' => __('Add file', 'wcvendors-pro' ),
'window_title' => __('Select an Image', 'wcvendors-pro' ),
'value' => $value
)
);
}
// call this function in your template
wcv_file_uploader();
@majidempire
Copy link

What if we want it required ? Normal attributes not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment