template.php fix if statement