Use WordPress oEmbed in Template

Embed media in your WordPress template using its oEmbed API. Behaves the same as pasting a supported URL into the editor.

<?php echo wp_oembed_get('http://www.youtube.com/watch?v=dQw4w9WgXcQ', array('width'=>500)); ?>

Adam Walter is a front-end developer, lover of WordPress, and Director of Development at Vital in Portsmouth, NH. Read more about me →