Support

Account

Home Forums Front-end Issues You tube in ACF field Reply To: You tube in ACF field

  • Hello, i found a solution, here is the code in the page:

    $video = get_field('video_youtube');
    if (!empty($video)){
    echo video_iframe_YT($video);
    echo '<iframe width="560" height="315" src="' . $video . '" frameborder="0" allowfullscreen></iframe>';
    }

    and the functiun :

    // VIDEO YT : iframe
    function video_iframe_YT($video_url)
    {
    $video_iframe			= '';
    // -----------------
    if( !empty($video_url))
    {
    $video_url = video_cleanURL_YT($video_url);
    $video_iframe = '<iframe width="560" height="315" src="' . $video_url . '"  frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>';
    }
    // -----------------
    return $video_iframe;
    };
    ?>

    I hope it will help someone!