How to Make Your Comments Compatible with WordPress 2.7 and Earlier Versions

2009-03-14 posted in Wordpress and Blogging Tips

WordPress 2.7 introduces a lot of enhancements and one of the major improvements of this new version is the new comment functionality. In WordPress 2.7, comments can be paged, threaded, etc. All of these functionalities are built-in but your theme must support it.

Before we proceed with the topic, it is important that you understand that enhanced comments are optional and its default is in the off mode, even after you have done the changes. In order to change the setting, you have to go to Settings –> Discussion panel to turn the feature on.

Strictly speaking, the word “compatibility” is not an appropriate term. The old themes will still work in the new version. The only issue here is that you will need the theme to support the threading, paging and the javascript enhancements.

This makes it important that your theme’s comments be compatible with WordPress 2.7. In order to unlock the potentials of WordPress 2.7’s comments, a couple of theme modifications are needed.

The first step would be to save the file as legacy.comments.php in the theme directory. After this, you have to create a WordPress 2.7-only comments file and save it as comments.php.

The procedure is to check the version of WordPress that has been installed.

In the theme’s functions.php file, add the following code:

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';

endif;

return $file;

}

?>

This completes the entire procedure.

Like this post? Please help share it via the following social sites. Your share keep us creating more useful posts.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
No Responses

Support Forum

I no longer offer theme support in the comment section. If you are having any Wordpress theme related issues, please go to the Forum for support.
All support related questions posted here will be deleted without notice.

Leave a Reply


* If you are having any Wordpress theme related issues, please go to the Forum for support.