Title: Init template shortcode
Last modified: August 30, 2016

---

# Init template shortcode

 *  Resolved [benhartwich](https://wordpress.org/support/users/yoursql719/)
 * (@yoursql719)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/init-template-shortcode/)
 * Hi,
 * currently I´m testing to insert your template code at a theme, and I know, that
   you can´t give me support for the theme. But it seems that the shortcode
    `<?
   php echo do_shortcode('[KGVID]'); ?>` isn´t initated, because the div where it
   ´s placed is empty.
 * Is there any possibility to init the shortcode at functions.php? Can you please
   give me a hint for testing and developing? Have I to initiate the kgvid anywhere
   or what is needed to run the shortcode?
 * Best,
 * [https://wordpress.org/plugins/video-embed-thumbnail-generator/](https://wordpress.org/plugins/video-embed-thumbnail-generator/)

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

 *  Plugin Author [Kyle Gilman](https://wordpress.org/support/users/kylegilman/)
 * (@kylegilman)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/init-template-shortcode/#post-6567706)
 * There’s no initializing to do. As long as there is at least one video attached
   to the post you’re testing with, then it will work. When the shortcode doesn’t
   output anything it’s almost always because the shortcode doesn’t have any videos
   to work with. First verify that the post you’re working with has a video attached
   to it. It’s also a good idea to verify that your template runs both `wp_head()`
   and `wp_footer()` which output necessary scripts and CSS to make the video players
   run. Try putting the shortcode in the post content as a test. If it’s not outputting
   anything from there either, then you know it’s not because of a problem with 
   the template editing.
 *  Thread Starter [benhartwich](https://wordpress.org/support/users/yoursql719/)
 * (@yoursql719)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/init-template-shortcode/#post-6567796)
 * Yes you´re right, it´s a theme issue. The code is working at the same article
   in twentyfifteen for example. The theme itself runs this code I think, but it
   ´s not set at this single file. I will try to set both at this file. It´s curious:
   there a few files at the theme, where the shortcode runs, but not at the file
   headers-single-video.php. Is there a limitation, that a shortcode from a plugin
   can only run at typical called theme files?
 * Could you provide the code for your plugin, which could be set at the functions.
   php?
 *  Plugin Author [Kyle Gilman](https://wordpress.org/support/users/kylegilman/)
 * (@kylegilman)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/init-template-shortcode/#post-6567816)
 * There is no code you could put in your functions.php file that will solve your
   problem. It is not surprising at all that you can’t get the code to run in the
   header section of a template file. The code must be run within [the Loop](https://codex.wordpress.org/The_Loop),
   otherwise the plugin has no idea what post you’re dealing with and won’t be able
   to find any videos attached to that post in order to display them.

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

The topic ‘Init template shortcode’ is closed to new replies.

 * ![](https://ps.w.org/video-embed-thumbnail-generator/assets/icon.svg?rev=2965979)
 * [Videopack](https://wordpress.org/plugins/video-embed-thumbnail-generator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/video-embed-thumbnail-generator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/)
 * [Active Topics](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/reviews/)

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [Kyle Gilman](https://wordpress.org/support/users/kylegilman/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/init-template-shortcode/#post-6567816)
 * Status: resolved