Theo dõi Yestech trên goole news

Code php tips

huong dan da ngon ngu shipping title trong wordpress

Code PHP Lấy ID youtube video

function get_youtube_id( $url ){
    parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );
    if( isset($my_array_of_vars['v']) ){
        return $my_array_of_vars['v'];
    }
    return '';
}

function get_youtube_video_embeg( $url ){
    $id = get_youtube_id($url);
    if( $id != '' )
    	return '<iframe class="youtube" width="100%" height="450" src="https://www.youtube.com/embed/'.$id.'" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>';
}

Code youtube video size 16:9

<div class="youtube-wrap">
  <iframe class="youtube" width="100%" height="100%" src="https://www.youtube.com/embed/N8Nr0vPMA7I"
    title="YouTube video player" frameborder="0"
    allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
    referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>
</div>

// CSS 

<style>
.youtube-wrap{
  position: relative;
  padding-top: 56.25%;
}
.youtube-wrap iframe{
  position: absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
}
</style>

 

Tìm hiểu thêm  Hướng dẫn đa ngôn ngữ shipping title trong wordpress