Plugin Author
mihdan
(@mihdan)
А каким плагином вы формируете фид для Турбо?
Извините, на почту почему-то уведомление об ответе не пришло.
Использую плагин “Яндекс.Турбо” от Flector.
Дело в том, что в турбо-страницах видео отображается только тогда, когда его передаешь во фрейме.
Временно вышел из положения с помощью регулярки, заменяя теги -может кому-то пригодится.
// Фильтр плагина ЮТ видео для турбо-страниц - заменяем на фрейм для турбо
function yturbo_replace_all_links( $content ) {
//что заменить в обычном ролике
$pattern = '/<lite-youtube class="lite-youtube_16x9" video-id="(.*?)" player-parameters="feature=oembed&rel=0&showinfo=0&modestbranding=1"><lite-youtube__button class="lite-youtube__button lty-playbtn"><\/lite-youtube__button><lite-youtube__preview class="lite-youtube__preview"><img (.*?)><\/lite-youtube__preview><lite-youtube__name class="lite-youtube__name"><\/lite-youtube__name><\/lite-youtube>/i';
//на что заменить
$replacement = '<iframe width="560" height="315" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" allowfullscreen="" src="https://www.youtube-nocookie.com/embed/$1?autoplay=1&feature=oembed&rel=0&showinfo=0&modestbranding=1"></iframe>';
//что заменить в ролике с возрастной категорией
$pattern_1 = '/https:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9_.+-]+)/i';
//на что заменить
$replacement_1 = '<iframe width="560" height="315" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture; fullscreen" allowfullscreen="" src="https://www.youtube-nocookie.com/embed/$1?autoplay=1&feature=oembed&rel=0&showinfo=0&modestbranding=1"></iframe>';
//производим замену
$content = preg_replace($pattern, $replacement, $content);
$content = preg_replace($pattern_1, $replacement_1, $content);
return $content;
}
add_filter( 'yturbo_the_content', 'yturbo_replace_all_links' );