Last active
April 11, 2017 20:28
-
-
Save braginteractive/cde2f93bdec96f0b56b8597107b9223a to your computer and use it in GitHub Desktop.
Embed responsive YouTube video into WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="entry-video"> | |
<?php | |
$url = get_post_meta( get_the_ID(), 'helpwp_url', true); | |
$yt_id = helpwp_youtube_id($url); | |
if ($url != '') : ?> | |
<div class="embed-responsive embed-responsive-16by9"> | |
<iframe class="embed-responsive-item" src="//www.youtube.com/embed/<?php echo esc_html( $yt_id ); ?>" allowfullscreen></iframe> | |
</div> | |
<?php else : | |
the_post_thumbnail(); | |
endif; ?> | |
</div><!-- .entry-video --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment