Created
April 5, 2017 10:53
-
-
Save celticwebdesign/8083354408547b956ee7782d8c656e99 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$local_folder = get_field('video_folder'); | |
$path = "/var/sites/k/XXX.co.uk/public_html/Videos/top-video-folder/".$local_folder; | |
$files = scandir($path); | |
foreach ($files as &$value) { | |
if ($value != "." && $value != "..") { | |
if( end( explode(".",$value) ) == "mp4" ) { | |
echo " | |
<div class='single-video'>"; | |
$pos = strpos( $value, '.mp4' ); | |
if( $pos > 0 ) { | |
$title = substr( $value, 0, $pos); | |
} | |
$file = "/var/sites/k/XXX.co.uk/public_html/Videos/top-video-folder/".$local_folder.$title.".jpg"; | |
if (file_exists($file)) { | |
$poster = "/Videos/top-video-folder/".$local_folder.$title.".jpg"; | |
} else { | |
$poster = get_template_directory_uri()."/images/video-placeholder.png"; | |
} | |
// <video autoplay loop muted playsinline preload poster='58653'> | |
echo "<video controls style='width: 100%;' poster='".$poster."'> | |
<source src='/Videos/top-video-folder/".$local_folder."/".$value."' type='video/mp4'></source> | |
</video> | |
<br /> | |
<h3>".$title."</h3>"; | |
echo " | |
</div> | |
"; | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment