Last active
December 18, 2015 00:59
-
-
Save JiveDig/5700958 to your computer and use it in GitHub Desktop.
Embed a video from YouTube, Vimeo, or HBO using custom fields created in Advanced Custom Fields
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 | |
/** | |
Template for single Videos posts | |
*/ | |
/** Embed the video from custom fields */ | |
add_action( 'genesis_post_content', 'jivedig_do_video_single', 1 ); | |
function jivedig_do_video_single() { | |
$video_url = get_field( "video_url" ); | |
$iframe_url = get_field( "iframe_url" ); | |
if( $video_url ) { | |
echo '<p>'; | |
echo wp_oembed_get ( $video_url ); | |
echo '</p>'; | |
} elseif( $iframe_url ) { | |
echo '<iframe class="hbo-embed" src="http://www.hbo.com/data/content/global/videos/embed/data/'; | |
echo $iframe_url; | |
echo '.html?height=288&width=512" height="288" width="512" style="overflow:hidden" scrolling="no" seamless="seamless" frameborder="0" type="text/html"></iframe>'; | |
} | |
} | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment