Created
August 14, 2014 12:20
-
-
Save rianrietveld/80e6fa94ca728fc4457a to your computer and use it in GitHub Desktop.
Embed a YouTube in WordPress, using Advances 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 | |
function rrwd_has_post_youtube( $post_id ) { | |
if ( !function_exists( 'get_field') ) | |
return; | |
if ( get_field( 'acf_youtube', $post_id ) ) { | |
echo '<iframe class="frame-youtube" src="http://www.youtube.com/embed/'. get_field( 'acf_youtube') . '?feature=oembed" name="youtube" frameborder="0" allowfullscreen></iframe>' . "\n"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment