Title: Shortcode problem when using in template files
Last modified: August 19, 2016

---

# Shortcode problem when using in template files

 *  [kriesiat](https://wordpress.org/support/users/kriesiat/)
 * (@kriesiat)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/shortcode-problem-5/)
 * Hey, I am trying to run a shortcode out of a template file with the `do_shortcode()`
   function. What I am trying to do is to display a media file that way:
 * `echo do_shortcode("[embed width='400']http://www.youtube.com/watch?v=qGLXpIojJkg[/
   embed]");`
 * Unfortunatley that doesnt work. I have tried using other shortcodes that way 
   and they work fine, Ive also tried to use that shortcode in a post and that also
   works fine. I just cant get it to work in the template file. Anything I am missing
   here?
 * Thanks and best regards
    Kriesi

Viewing 1 replies (of 1 total)

 *  [mmodic](https://wordpress.org/support/users/mmodic/)
 * (@mmodic)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/shortcode-problem-5/#post-1667583)
 * try
 * `echo apply_filters( 'the_content', '[embed width='400']http://www.youtube.com/
   watch?v=qGLXpIojJkg[/embed]' );`

Viewing 1 replies (of 1 total)

The topic ‘Shortcode problem when using in template files’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [mmodic](https://wordpress.org/support/users/mmodic/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/shortcode-problem-5/#post-1667583)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
