How to Add Numbers to WordPress Comments

Have you ever seen a WordPress site with a number beside the comments form? This is an example from a site we did for a client recently.

numbers in wordpress comments

Personally, we believe there’s no real benefit of having the numbers beside your comments but adding the numbers probably will make your site looks more unique. To add numbers to WordPress comments, all you need to do is to install and activate Greg’s Threaded Comment Numbering plugin.

The plugin works out of the box. Once installed, you’ll see the number beside each comment,sequentially and hierarchically.

For more control, the plugin comes with a settings page that allows you to change the default settings.

Bonus: Adding Support for Genesis Framework

Although the plugin works on most WordPress themes, for Genesis Framework users, you need to add some code to add support for this plugin to work on your Genesis child theme.

1 2 3 4 5 6 7 8
<?php
//* Add Support for Comment Numbering
add_action ('genesis_before_comment', 'afn_numbered_comments');
function afn_numbered_comments () {
if (function_exists('gtcn_comment_numbering'))
echo gtcn_comment_numbering($comment->comment_ID, $args);
}
view raw functions.php hosted with ❤ by GitHub

This code should be in functions.php file of your child theme. If you notice, in line 6 we’re checking whether the plugin is active using if (function_exists('gtcn_comment_numbering')) so that if you accidentally deactivate or no longer use the plugin, your site will not broken.

Bonus: Suggested CSS for Styling

The plugin just add the numbers to your comments. Nothing fancy. However, if you’d like to add some styling, please take a look at this Gist. Please see the first image above to see how the numbers will look like.

Leave a Reply

Your email address will not be published. Required fields are marked *