-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom-videos.txt
34 lines (24 loc) · 894 Bytes
/
custom-videos.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
This code snippet is an example of how you can add your own custom videos to the videos page via a plugin or functions.php:
<?php
add_filter('wpmudev_vids_list', function( $video_list ) {
$video_list[ 'myvid' ] = 'My Favorite Vid';
return $video_list;
});
add_filter('wpmudev_vids_categories', function( $video_cats ) {
//add to other category
$video_cats[ 'other' ][ 'list' ][] = 'myvid';
//create my own category
$video_cats['mine'] = array(
'name' => 'My Category',
'list' => array( 'myvid' )
);
return $video_cats;
});
add_filter('wpmudev_vids_embed_html', function( $video_html, $slug ) {
if ( 'myvid' == $slug ) {
$video_html = '<iframe width="640" height="480" src="https://www.youtube.com/embed/dQw4w9WgXcQ?rel=0&controls=0&showinfo=0&autoplay=1" frameborder="0" allowfullscreen></iframe>';
}
return $video_html;
}, 10, 2);
?>
403900-1512269322-au