Limited Support
Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed.
We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.
Currently, Wordpress automatically embeds YouTube videos. I read you work in an addon for embeds multitude of services, something very interesting. But, on the other hand, you could not enable the original WP embed function for YouTube?
I want to start to migrate to WP Foro, but without YouTube is difficult. To start (to start...) I not need a media player, or insert other services, but YouTube is basic in a forum, and the embed of WordPress works great.
Thanks! 🙂
seems like we have a solution.
Can you guys share what exactly does this modification do? Does it work all across wp-foro?
Just put this code in active WordPress theme's functions.php:
add_filter('wpforo_content_after', 'wpforo_custom_video_embed', 10);
function wpforo_custom_video_embed( $content ){
$paterns = array();
$paterns[] = "/<a[^><]+>\s*[a-zA-Z\/\/:\.]*youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i";
$paterns[] = "/<a[^><]+>\s*[a-zA-Z\/\/:\.]*youtu.be\/([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i";
$content = preg_replace($paterns, "<iframe width=\"420\" height=\"280\" src=\"//www.youtube.com/embed/$1\" frameborder=\"0\" allowfullscreen></iframe>", $content);
return $content;
}
For more embedding options I recommend wpForo Embeds addon:
All working now 🙂 thanks to all. Used your instructions Robert 🙂
I have two questions about the code that was added in Step 1.
I'm getting <Va> after the insert of the video. Re-checked my files and found no typos.
Second part is what if the user is posting with the short URL from YouTube
https ://youtu.be/SSSSSSS