Skip to content

Instantly share code, notes, and snippets.

@millipedia
Last active March 13, 2019 11:30
Show Gist options
  • Save millipedia/10017099 to your computer and use it in GitHub Desktop.
Save millipedia/10017099 to your computer and use it in GitHub Desktop.
CMS Made Simple User Defined Tag for embedding a Youtube video
// write out an embed tag for a youtube vid.
$ytCode=$params['code'];
if(isset($params['height'])){
$height=$params['height'];
}else{
$height=290;
}
if(isset($params['width'])){
$width=$params['width'];
}else{
$width=560;
}
if(isset($params['autoplay'])){
$autoplay=$params['autoplay'];
}else{
$autoplay=0;
}
$vidString='<div class="embed-responsive embed-responsive-16by9">';
$vidString.='<iframe width="'.$width.'" height="'. $height .'" src="https://www.youtube.com/embed/' . $ytCode .'?rel=0&modestbranding=1&showinfo=0" frameborder="0" allowfullscreen></iframe>';
$vidString.='</div>';
echo $vidString;
@millipedia
Copy link
Author

millipedia commented Mar 13, 2019

There is now a plugin version of this UDT over at https://github.com/millipedia/CMSMS_plugins - you should probably use that instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment