How to avoid having javascript in PHP file?

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

0 0 188
0 REPLIES 0
Top Labels in this Space
Top Solution Authors