oEmbed or video Embed code with custom field (2 posts)

  1. jayo
    Posted 3 years ago #

    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')) { ?>
    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 } ?>
  2. jayo
    Posted 2 years ago #

    Can anyone help with this?

Topic Closed

This topic has been closed to new replies.

About this Topic