Video Uploader
The video-uploader
lets you add a field for uploading and selecting video files in WordPress Media Library.

Parameters
Here are the parameters in adding video-uploader
.
a unique slug-like string to use as an id and also as index in saving data in database.
the label of the field.
the description of the field and display under the label.
the section where the field will be displayed.
the default value of the field.
Note: default value must be valid or existing "attachment ID"
determines the order of fields in section.
display placeholder in the field.
allowing to set the allowed audio extensions.
Note: here are the list of allowed extensions [ 'mp4', 'm4v', 'mov', 'wmv', 'avi', 'mpg', 'ogv', '3gp', '3g2', 'webm', 'mkv' ]
Example
Yano::field( 'video-uploader', [
'id' => 'videuploaderdb1',
'label' => 'Select Video',
'description' => 'Description Here.',
'section' => 'section_id',
'priority' => 1,
'placeholder' => 'Select Video'
] );
Example with default
value! note: default value can only be supplied of the attachment ID
.
Yano::field( 'video-uploader', [
'id' => 'videuploaderdb1',
'label' => 'Select Video',
'description' => 'Description Here.',
'section' => 'section_id',
'default' => 123,
'priority' => 1,
'placeholder' => 'Select Video'
] );
Example with extensions
value! note: here are the list of allowed extensions mp4
, m4v
, mov
, wmv
, avi
, mpg
, ogv
, 3gp
, 3g2
, webm
, mkv
.
Yano::field( 'video-uploader', [
'id' => 'videuploaderdb1',
'label' => 'Select Video',
'description' => 'Description Here.',
'section' => 'section_id',
'default' => 123,
'priority' => 1,
'placeholder' => 'Select Video',
'extensions' => [ 'mp4', 'mkv' ]
] );
Usage
The get_theme_mod()
function is recommended to retrieve data.
// Getting the url
wp_get_attachement_url( get_theme_mod('videuploaderdb1') );