Stefano Garuti
Member
Posted 1 year ago #
Hi want to embed a YouTube video in an area of a WP page.
So I decided to use the default [embed] shortcode and put the following in my theme:
echo (do_shortcode('[embed width="480" height="360"]'.'http://www.youtube.com/watch?v=JaNH56Vpg-A'.'[/embed]'));
Unfortunately this doesn't echoes anything.
Where I'm wrong?
p.s.
I'm not sure that this does metter but yes, the auto-embed function in Settings->Media is activated
Thank you!
Stefano
Not sure if it will fix your problem, but you seem to be doing some unnecessary concatenation which could be affecting some filter. Try using:
echo do_shortcode('[embed width="480" height="360"]http://www.youtube.com/watch?v=JaNH56Vpg-A[/embed]');
Stefano Garuti
Member
Posted 1 year ago #
Kionae, thank you!
yes the concatenation is unecessary.. I left it here because the original code I'm using uses a variable, but for testing I just used a string.
The original code is:
echo do_shortcode('[embed width="480" height="360"]'.$youtube_video_url.'[/embed]');
Thank you!