How to connect a custom plugin in LightGallery

143 Views Asked by At

I am currently trying to make a custom plugin to lightgallery (2.7.0). My source code for lg currently is cdn and wordpress (using wp_enqueue_script). As far as I can tell, current lg plugins are coded in typescript rather than javascript.

Here is my cdn connections:

wp_enqueue_script( 'lightgallery', 'https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.7.0/lightgallery.min.js', array(), '1.1', 'all' );
    wp_enqueue_script( 'lightgallery-settings', get_template_directory_uri() . '/assets/js/lightgallery-settings.js', array( 'jquery' ), '1.1', true );
    wp_enqueue_script( 'lightgallery-gallery-plugin', get_template_directory_uri() . '/assets/js/lg-gallery-plugin.js', array( 'jquery' ), '1.1', true );
    wp_enqueue_script( 'lightgallery-autoplay', 'https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.7.0/plugins/autoplay/lg-autoplay.min.js', array( 'jquery' ), null, true );

My settings file:

(function ($) {
    'use strict';

    $(document).ready(function () {
        $('#dataTables-example').dataTable();

        lightGallery(document.getElementById('lightgallery'), {
            plugins: [lgAutoplay],
            thumbnail: true,
            selector: '.img-responsive'
        });
    });

}(jQuery));    

I have tried older methods of creating plugins using javascript, however, it is pulling errors and I believe this is due to the fact that using js for plugins is a method for older versions of lightgallery.

Anyone have any experience with this?

0

There are 0 best solutions below