Created
July 24, 2012 21:25
-
-
Save smonteverdi/3172755 to your computer and use it in GitHub Desktop.
WordPress: Embed YouTube vid with custom field
This file contains 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
Make a custom field in post first.... ex. video_url | |
// Get the video URL and put it in the $video variable | |
$video = get_post_meta($post->ID, 'video_url', true); | |
// Echo the embed code via oEmbed | |
echo wp_oembed_get( $video, array( 'width' => 218, 'height' => 127 )); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment