i need to call a javascript only if screen resolution is greater than 500. I found below code... <script type='text/javascript' src='<?php echo $urlPlugin?>js/jquery.themepunch.revolution.min.js?rev=<?php echo RevSliderGlobals::SLIDER_REVISION; ?>'></script> So, i modified it as below... <script> if (window.innerWidth > 500) { var head = document.getElementsByTagName('head')[0]; var s1 = document.createElement("script"); s1.type = "text/javascript"; s1.src = "http://domain.com/wp-content/plugins/revslider/public/assets/js/jquery.themepunch.revolution.min.js"; head.appendChild(s1); } </script> However that did not work. Later i came to know about enqueue function. i have lines as following... wp_enqueue_script('revmin', RS_PLUGIN_URL .'public/assets/js/jquery.themepunch.revolution.min.js', 'tp-tools', $slver, $ft); this function auto-calls scripts. so, how do i make it conditional??