PHP mixed with some JS code to update WordPress theme settings

The way I see, you could minimize code mixing storing the return value of get_theme_option(“bg_slideshow”) into a JS variable, although it would not solve the problem as whole: var themeOptBgSlideshow = <?php echo get_theme_option(“bg_slideshow”); ?>; if(themeOptBgSlideshow == 1){ /* Background Images */ var bg_slideshow = jQuery(“.bg_slideshow”).attr(“data-active”); if(bg_slideshow == 1) { jQuery.vegas(‘slideshow’, { delay: 8000, backgrounds:[ … Read more