Skip to content

Instantly share code, notes, and snippets.

@staylor
Created February 20, 2013 23:34
Show Gist options
  • Save staylor/5000714 to your computer and use it in GitHub Desktop.
Save staylor/5000714 to your computer and use it in GitHub Desktop.
<?php
/**
* Handle oEmbed and embedded media
*
* @param $content
*/
function the_featured_audio( &$content ) {
$url = trim( array_shift( explode( "\n", $content ) ) );
if ( 0 === strpos( $url, 'http://' ) ) {
echo apply_filters( 'the_content', $url );
$content = trim( str_replace( $url, '', $content ) );
} else if ( preg_match ( '#^<(script|iframe|embed|object)#i', $url ) ) {
echo $url;
$content = trim( str_replace( $url, '', $content ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment