Looking for a function that checks if script was loaded before
-
Hi,
I am trying to compress all my javascript files and output it as one file.
I am using this code:
<?php header('Content-Type: text/javascript'); function my_obstart() { $encode = getenv('HTTP_ACCEPT_ENCODING'); if (strstr($encode, 'gzip')) { ob_start('ob_gzhandler'); } else { ob_start(); } } my_obstart(); require_once 'jquery.js'; require_once 'main.js'; require_once 'boostrap.js'; require_once 'lesscss.js'; ob_end_flush();In my code above you see that I am using required_once instead of
wp_register_script(‘myscript’, get_template_directory_uri() . ‘/myscript.js’, false, null, true);
wp_enqueue_script(‘myscript’);
Obviously I can not use this function but yet I need to know if the script has been included by any other plugin. So I need a function that gives me either true or false before I use require_once.I would appreciate any help!
The topic ‘Looking for a function that checks if script was loaded before’ is closed to new replies.