I have a Wordpress plugin based on the Lightgallery Javascript plugin. Javascript is needed to initialize the javascript gallery, and different galleries can have different settings (which is defined in the JS that initalizes the gallery).
My code works, but itโs pretty messy having PHP and JS in the same fileโฆ
Hereโs some example code from Lightgallery