Skip to content

Instantly share code, notes, and snippets.

@hmbashar
Created February 6, 2019 01:53
Show Gist options
  • Save hmbashar/9ce478d61d039a89235dfea73fd26180 to your computer and use it in GitHub Desktop.
Save hmbashar/9ce478d61d039a89235dfea73fd26180 to your computer and use it in GitHub Desktop.
Thumbnail Video
// Function
function cb_get_embedded_media( $type = array() ){
$content = do_shortcode( apply_filters( 'the_content', get_the_content() ) );
$embed = get_media_embedded_in_content( $content, $type );
if( in_array( 'audio' , $type) ):
$output = str_replace( '?visual=true', '?visual=false', $embed[0] );
else:
$output = $embed[0];
endif;
return $output;
}
// Call
<?php echo cb_get_embedded_media( array('video','iframe') ); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment