Video Uploader
The Video Uploader controller allows users to choose a video from the WordPress Media Library.

Demonstration
Handy::control( 'video-uploader', [
'id' => 'video_uploader_id',
'section' => 'layout_section',
'label' => esc_html__( 'Video Uploader Control', 'textdomain' ),
'description' => esc_html__( 'Description Here', 'textdomain' ),
'placeholder' => esc_html__( 'Upload Video Here', 'textdomain' ),
'priority' => 1
]);
TIP
Here's an example using the default parameter. Note the default value accepts only an attachment ID.
Handy::control( 'video-uploader', [
'id' => 'video_uploader_id',
'section' => 'layout_section',
'default' => 100,
'label' => esc_html__( 'Video Uploader Control', 'textdomain' ),
'description' => esc_html__( 'Description Here', 'textdomain' ),
'placeholder' => esc_html__( 'Upload Video Here', 'textdomain' ),
'priority' => 1
]);
TIP
Here's an example using extensions parameter. These are the list of allowed video extensions: mp4, m4v, mov, wmv, avi, mpg, ogv, 3gp, 3g2, webm and mkv.
Handy::control( 'video-uploader', [
'id' => 'video_uploader_id',
'section' => 'layout_section',
'default' => 100,
'label' => esc_html__( 'Video Uploader Control', 'textdomain' ),
'description' => esc_html__( 'Description Here', 'textdomain' ),
'placeholder' => esc_html__( 'Upload Video Here', 'textdomain' ),
'extensions' => [ 'mp4', 'm4v' ],
'priority' => 1
]);
Basic Usage
// Return an attachment id.
$value = get_theme_mod( 'video_uploader_id' );
Parameters
| Name | Description |
|---|---|
| id |
The unique slug like string used as an ID and also as an index name in storing data in a database. |
| section |
The ID of the section in which the control will be displayed. |
| default |
The predetermined value of the control. Accepts only an |
| extensions |
The defined video extensions that are allowed. Accepts only |
| label |
The label or title of the control to show in the UI. Default empty. |
| description |
The description of the control to show in the UI. Default empty. |
| placeholder |
The placeholder of the control to show in the UI. Default empty. |
| priority |
The order of control appears in the section. Default |
| validations |
The set of validations used to validate the value of the control. For further details, read validations. Default empty. |
| active_callback |
A callback function that determines the visibility of a control, whether to show or hide depending on a condition. For further details, read active_callback. Default empty. |
| sanitize_callback |
A callback function that sanitizes the value of control before storing it in the database. Note that this is only optional since each control is already well sanitized. For further details, read sanitize_callback. Default empty. |