I'm pretty tired right now and I guess I'm missing something. I use this piece of code to output youtube videos in my articles with a custom field. 'video_url' being the custom field name and the value is not the youtube URL but only the ID.
<?php
// Get the video URL and put it in the $video variable
$videoID = get_post_meta($post->ID, 'video_url', true);
// Echo the embed code via oEmbed
echo wp_oembed_get( 'http://ift.tt/mkzSv0' . $videoID );
?>
What I need to change to make this more generic? So instead of the Youtube video ID to put as a field value the Youtube url? Or Vimeo url if I want...etc, and to be Oembedded by Wordpress?
Thank you for the help.
Aucun commentaire:
Enregistrer un commentaire