Skip to content

Instantly share code, notes, and snippets.

@bradpotter
Last active December 11, 2015 18:19
Show Gist options
  • Save bradpotter/4640582 to your computer and use it in GitHub Desktop.
Save bradpotter/4640582 to your computer and use it in GitHub Desktop.
Enqueue fitvids from https://github.com/davatron5000/FitVids.js | Props to @realFATmedia & @krogsgard
// Add to functions file
add_action('wp_enqueue_scripts', 'child_javascript_files');
function child_javascript_files() {
wp_register_script( 'fitvids', get_stylesheet_directory_uri() . '/js/jquery.fitvids.js', array('jquery'), '1.0', true );
wp_register_script( 'loadfitvids', get_stylesheet_directory_uri() . '/js/load.fitvids.js', array('fitvids'), '1.0', true );
wp_enqueue_script( 'fitvids' );
wp_enqueue_script( 'loadfitvids' );
}
// Create a file named load.fitvids.js and enter the following
jQuery(document).ready(function($){
// Target your .container, .wrapper, .post, etc.
$(".videowrap").fitVids();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment