Title: How to use [embed] shortcode in a theme function?
Last modified: August 20, 2016

---

# How to use [embed] shortcode in a theme function?

 *  [Stefano Garuti](https://wordpress.org/support/users/garubi/)
 * (@garubi)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/how-to-use-embed-shortcode-in-a-theme-function/)
 * 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

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Nikki Blight](https://wordpress.org/support/users/kionae/)
 * (@kionae)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/how-to-use-embed-shortcode-in-a-theme-function/#post-2584770)
 * 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]');`
 *  Thread Starter [Stefano Garuti](https://wordpress.org/support/users/garubi/)
 * (@garubi)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/how-to-use-embed-shortcode-in-a-theme-function/#post-2584771)
 * 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!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to use [embed] shortcode in a theme function?’ is closed to new replies.

## Tags

 * [embed](https://wordpress.org/support/topic-tag/embed/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [Youtube](https://wordpress.org/support/topic-tag/youtube/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Stefano Garuti](https://wordpress.org/support/users/garubi/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/how-to-use-embed-shortcode-in-a-theme-function/#post-2584771)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
