Reply To: Add FitVids to GeneratePress for responsive videos

Home Forums Support Add FitVids to GeneratePress for responsive videos Reply To: Add FitVids to GeneratePress for responsive videos

Home Forums Support Add FitVids to GeneratePress for responsive videos Reply To: Add FitVids to GeneratePress for responsive videos

#200315
Tom
Lead Developer
Lead Developer

This is the file you want to save: https://raw.githubusercontent.com/davatron5000/FitVids.js/master/jquery.fitvids.js

Then upload it to your child theme.

Add this function to the functions.php file in your child theme:

add_action( 'wp_enqueue_scripts', 'generate_fitvids' );
function generate_fitvids() 
{
    wp_enqueue_script( 'fitvids', get_stylesheet_directory_uri() . "/jquery.fitvids.js", array( 'jquery' ), '1.0', true );
}

This assumes you uploaded the file as jquery.fitvids.js and uploaded it to the root directory of your child theme.

Then add this in the wp_footer link in GP Hooks:

<script>
  jQuery(document).ready(function($){
    // Target your .container, .wrapper, .post, etc.
    $("#thing-with-videos").fitVids();
  });
</script>