2011-10-13, 10:27 PM
I am thinking of adding jquery to one of my plugins but need the best way to know if I need to add the jquery lines to the header or not. Since I know its added by some users and some themes, it may or may not already be inserted.
I assume inserting a placeholder into header <--myjquery--> and then doing this in global_end is the simplest way, but is it efficient or the best solution?
I assume inserting a placeholder into header <--myjquery--> and then doing this in global_end is the simplest way, but is it efficient or the best solution?
$myjquery_bit = '<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>';
if(!stristr($header, 'jquery'))
{
$header = str_replace('<--myjquery-->', $myjquery_bit, $header);
}