Medias Management
Last updated Tuesday 17 February 2026Download and display your images, videos and audio files.
Location
- Located in
src/themes/reactwp/js/inc/Loader.js - Located in
src/themes/reactwp/template/functions.php
Register Media to Download
In your functions.php, find this line:
$mediasToDownload = [];
Next, add your media groups to call later:
$mediasToDownload = [
'group1' => [
$array1,
$array2
],
'group2' => [
$array3
]
];
With JavaScript, you can retrieve your medias with the MEDIAS variable.
$array parameters:
- type (string, required)
Value: image | video | audio - src (string, required)
Value: Absolute URL or URL path of the media file - target (string | array of strings, optional)
Value: CSS selector used to inject the media into the DOM (one selector per page) - sources (array of arrays, optional)
[ [ 'src' => 'Absolute URL or URL path', 'media' => 'CSS media query (e.g. (max-width: 768px))' ] ] - alt (string, optional, only for images)
Value: Alternative text used for accessibility and SEO - muted (bool, optional, only for videos and audios)
Value: true | false (mutes the media by default) - loop (bool, optional, only for videos and audios)
Value: true | false (restarts the media automatically when it ends) - autoplay (bool, optional, only for videos)
Value: true | false (plays the video automatically after download and injection) - controls (bool, optional, only for videos and audios)
Value: true | false (displays native media controls)
Use Media Groups
By default, Pages and Posts include a “Media Groups” field in their admin edit screen. Simply add your media group keys separated by commas.
You can enable the “Media Groups” field for custom post types here: Top Bar > ReactWP Tab > Site Settings > Media Groups Post Types
Also, you can force media groups via Routes or ACF filters.