[wp-hackers] template checks
Joost de Valk
joost at yoast.com
Tue May 26 21:44:52 GMT 2009
Hey,
I've just added this:
// Check for wp_footer
$templates = array();
$templates[] = "footer.php";
$file = file_get_contents(locate_template($templates));
preg_match('/.*(wp_footer\(\);).*/',$file,$matches);
if (!$matches[1]) {
echo "<div id=\"message\"
class=\"error\"><p><strong>Warning</strong> wp_footer(); not found in
your footer.php file, this might mean this plugin will not
work!</p></div>\n";
}
to my Google Analytics plugin, after the gazillionth complaint from
somebody that their theme didn't have a wp_footer call. Is it an idea to
add a check like this for both wp_footer and wp_head into WordPress
core, or give people some other way to validate these things are right
before they start complaining to plugin authors?
I know this could break on themes with no footer.php file, any hints to
more subtle checks are appreciated :)
Best,
Joost
--
*Joost de Valk*
Online Marketing, WordPress, SEO & Social Media Strategy
OrangeValley <http://www.orangevalley.nl> & Yoast <http://yoast.com>
E: joost at orangevalley.nl <mailto:joost at orangevalley.nl> -
joost at yoast.com <mailto:joost at yoast.com>
T: +316-24-555-808 | @yoast <http://twitter.com/yoast> on Twitter
More information about the wp-hackers
mailing list