Skip to content

Instantly share code, notes, and snippets.

@mikeoberdick
Created March 6, 2023 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeoberdick/46150b2ff1f7412da5b7203696df461e to your computer and use it in GitHub Desktop.
Save mikeoberdick/46150b2ff1f7412da5b7203696df461e to your computer and use it in GitHub Desktop.
Conditional video script for either an ACF file or an oEmbed (YouTube video)
<?php if ($sectionTwo['video_type'] == 'file') { ?>
<?php $video = $sectionTwo['video_file']; ?>
<video class = "w-100" controls poster="<?php echo get_stylesheet_directory_uri() . '/img/poster.jpg'; ?>">
<source src="<?php echo $sectionTwo['vide_file]; ?>" type="video/mp4">
Your browser does not support the video tag.
</video>
<?php } else { ?>
<div class="embed-container">
<?php echo $sectionTwo['youtube_video']; ?>
</div><!-- .embed-container -->
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment