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

#197841
Tom
Lead Developer
Lead Developer

It should be quite easy to add if you have a child theme.

First, upload jquery.fitvids.js into your child theme.

Then add this as a function:

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 );
}

Then you could add this into the wp_footer hook in GP Hooks:

<script>
  jQuery(document).ready(function($){
    // Target your .container, .wrapper, .post, etc.
    $("#thing-with-videos").fitVids();
  });
</script>
  • This reply was modified 5 years ago by Tom.