oEmbed or video Embed code with custom field
-
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) === 'https://youtu.be' || 'https://vimeo.com' ) { echo wp_oembed_get( get_post_meta($post->ID, 'customfield', true)) . '<br /><br />'; } ?> <?php } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘oEmbed or video Embed code with custom field’ is closed to new replies.