• 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.