Created
June 15, 2015 22:49
Revisions
-
devinsays created this gist
Jun 15, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ /** * Enqueue theme scripts */ function prefix_scripts() { // FitVids Script conditionally enqueued from inc/extras.php wp_register_script( 'prefix-fitvids', get_template_directory_uri() . '/js/jquery.fitvids.min.js', array( 'jquery' ), '1.0.0', true ); } add_action( 'wp_enqueue_scripts', 'prefix_scripts' ); /** * Enqueues FitVids, since the embed might be a video. * * @since 1.0.0. * * @param string $html The generated HTML of the embed handler. * @param string $url The embed URL. * @param array $attr The attributes of the embed shortcode. * * @return string Returned HTML. */ function prefix_embed_container( $html, $url, $attr ) { // Bail if this is the admin if ( is_admin() ) { return $html; } if ( isset( $attr['width'] ) ) { wp_enqueue_script( 'prefix-fitvids' ); } return $html; } add_filter( 'embed_handler_html', 'prefix_embed_container', 10, 3 ); add_filter( 'embed_oembed_html' , 'prefix_embed_container', 10, 3 );