Make your comments template compatible with WordPress 2.7 and older versions

November 11, 2008 · Print This Article

You’ll need two file:
The first one is a WordPress 2.7 compatible comments file, named comments.php.

The second one is a comment template for older WordPress versions, named legacy.comments.php in this exemple.

Paste this elegant code in your theme functions.php file. Create this file if it do not exists yet. If the wp_list_comments() function doesn’t exists, the code will automatically load legacy.comments.php instead of comments.php.

add_filter('comments_template', 'legacy_comments');

function legacy_comments($file) {
if(!function_exists('wp_list_comments')) : // WP 2.7-only check
$file = TEMPLATEPATH.'/legacy.comments.php';
return $file;

Your choice for site templates and wordpress themes


Got something to say?

You must be logged in to post a comment.