Controls
File
File control lets you upload and select files using the WordPress Media Library. The control stores file information as an array.
Control Settings
- Allowed Mime Types - Limit allowed file types (example:
jpg
,webp
)
Saved Data
The control saves the following file information:
Name | Description |
---|---|
id | Unique ID of uploaded file |
url | URL to access the file |
alt | Optional alt attribute used in <img> tags |
caption | Optional caption |
link | Link to file |
Usage
PHP
<audio src="<?php echo esc_url( $attributes['control_name']['url'] ); ?>" controls>
</audio>
Handlebars
<audio src="{{control_name.url}}" controls>
</audio>
Post Meta
<?php
$file = get_lzb_meta( 'control_meta_name' );
?>
<audio src="<?php echo esc_url( $file['url'] ); ?>" controls>
</audio>
The control uses the native WordPress Media Library for file uploads and selection.