1. Home
  2. Knowledge Base
  3. Modula Extensions Explained
  4. Modula Video – How to Loop Self-Hosted Videos

Modula Video – How to Loop Self-Hosted Videos

Modula Video is a versatile plugin that allows users to seamlessly integrate videos into their Modula galleries. In this documentation article, we will guide you through the process of looping self-hosted videos using custom code. Looping videos can be a useful feature for enhancing user engagement and improving the overall viewing experience on your website.

Prerequisites

Before proceeding with the steps outlined in this guide, ensure that you have the following:

  1. WordPress Installation: Make sure you have a WordPress website up and running.
  2. Modula: the main lite/free plugin installed and active.
  3. Modula Pro: the premium plugin installed and activated on the website. You will also need to activate your license key.
  4. Modula Video: Install and activate the Modula Video extension on your WordPress site.

Looping Self-Hosted Videos

To loop self-hosted videos, follow the steps below. We recommend using a child theme to make changes to your theme’s files safely.

Step 1: Access the Theme’s functions.php File

  1. Open your WordPress dashboard.
  2. Navigate to “Appearance” and then click on “Theme Editor.”
  3. On the right-hand side, locate and click on “Theme Functions (functions.php)”.

Step 2: Add the Looping Code

Paste the following code at the end of your theme’s functions.php file:

$(document).bind('DOMSubtreeModified', function () {
if($('video').length){
$('video').attr('loop','loop');
if( $("video").prop('muted') ){
$("video").prop('muted', false);
}
}
});

Step 3: Save Changes

After adding the code, click the “Update File” button to save the changes to your theme’s functions.php file.

Additional Tip: Use a Child Theme

It’s always recommended to use a child theme when making changes to your theme’s files. This ensures that your modifications won’t be lost during theme updates. If you’re unfamiliar with creating a WordPress child theme, you can follow this guide: How to Create a WordPress Child Theme.

Conclusion

By following these steps, you can easily enable video looping for self-hosted videos on your WordPress website using the Modula Video plugin. Enhance user engagement and provide a seamless viewing experience by incorporating this feature into your multimedia content.

Was this article helpful?

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *