Title: Enqueue video script within short code
Last modified: August 21, 2016

---

# Enqueue video script within short code

 *  [jimbocook](https://wordpress.org/support/users/jimbocook/)
 * (@jimbocook)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/enqueue-video-script-within-short-code/)
 * Not sure if this is the right way to handle it but…
 * I have a shortcode for embedding videos that take a variable which identifies
   the video:
 *     ```
       /** Add shortcode for videos in course*/
       function pq_course_videos_func($atts) {
       extract( shortcode_atts( array(
       		'vid' => 'something',
       	), $atts ) );
       echo '<div class="pq-video-player"><script type="text/javascript" src="http://www.videohost.com/embed.php?v=' . $vid . '&statTrack=&w=570&h=321"></script></div>';
       }
       add_shortcode('pq_course_videos', 'pq_course_videos_func');
       ```
   
 * When, for some reason, the video is unavailable the entire page beyond the video
   won’t load until the video host’s server times out.
 * It there a way to enqueue the script within the shortcode so that it doesn’t 
   try to load until the footer of the page? Or is there another solution?

The topic ‘Enqueue video script within short code’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [jimbocook](https://wordpress.org/support/users/jimbocook/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/enqueue-video-script-within-short-code/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
