[wp-hackers] template checks

Joost de Valk joost at yoast.com
Tue May 26 21:44:52 GMT 2009


I've just added this:

// Check for wp_footer
$templates = array();
$templates[] = "footer.php";
$file = file_get_contents(locate_template($templates));
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 

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 :)


*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