Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

jayo on "oEmbed or video Embed code with custom field"

$
0
0

Been trying to figure it out for a long time, but cant.

Im trying to achieve, being able to use a custom field to post videos, but to output a video using the Oembed option or using an embed code (so, you can post a video that's not from Youtube, or Vimeo, etc).

Here's what I have so far. Works fine, in posting an embed code, but if you place a youtube URL or vimeo url in the custom field, it just spits out the URL and doesnt use the Oembed ability to embed the video clip.

<?php if(has_post_format('video')) { ?>
<?php
if ( get_post_meta($post->ID,'customfield', true) === 'iframe' || 'object' || 'embed' ) {
echo get_post_meta($post->ID,'customfield',true) . '<br /><br />';
} else if (get_post_meta($post->ID,'customfield', true) === 'http://youtu.be' || 'http://vimeo.com' ) {
echo wp_oembed_get( get_post_meta($post->ID, 'customfield', true)) . '<br /><br />'; }
?>
<?php } ?>

Viewing all articles
Browse latest Browse all 8245

Trending Articles