• Is there a way to enact Oembed to show a video from a custom field? Is there a way to wrap the function around the custom field?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m interested in this as well. Would like to create a sidebar widget (not widgitized is fine).

    Hi joehuffman2,

    I wanted the same thing and achieve it using this code in my single.php file:

    <?php echo wp_oembed_get( get_post_meta($post->ID, "videourlcustom", true) ); ?>

    In the example, videourlcustom is the name of the custom field which contains the URL for what you want to embed.

    If you want to put it somewhere else, just change $post->ID to the ID of the post you want to query – for example, if you were going to place it in a sidebar widget. In this example, it should be inside the loop.

    I hope this helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘OEmbed and Custom FIeld’ is closed to new replies.