Last active
July 31, 2019 14:49
-
-
Save Trovin/9ff6fb504a1aa00194c89b7a7a4f8994 to your computer and use it in GitHub Desktop.
PHP - WP youtube and vimeo generated src and settings, need change url to your value
This file contains hidden or 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
//youtube | |
<?php | |
$url = 'https://www.youtube.com/embed/5DEdR5lqnDE'; //change url | |
$list_id = array_pop(explode('/', $url)); | |
$autoplay = '?autoplay=1'; | |
$controls = '&controls=0'; | |
$loop = '&loop=1'; | |
$rel = '&rel=0'; | |
$mute = '&mute=1'; | |
$playlist = '&playlist='.$list_id.''; | |
$src = $url . $autoplay . $controls . $loop . $rel . $mute . $playlist; | |
?> | |
<iframe width="100%" height="500" src="<?php echo $src; ?>" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope;" allowfullscreen></iframe> | |
//vimeo | |
<?php | |
$url = 'https://player.vimeo.com/video/76979871'; //change url | |
$autoplay = '?autoplay=1'; | |
$controls = '&controls=0'; | |
$loop = '&loop=1'; | |
$mute = '&muted=1'; | |
$playlist = '&playsinline=1'; | |
$autopause = '&autopause=0'; | |
$src = $url . $autoplay . $controls . $loop . $mute . $playlist . $autopause; | |
?> | |
<iframe src="<?php echo $src; ?>" width="100%" height="500" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment