Every blog contains comments. These comments are displayed according to the time of the posts by default. Same is the case with wordpress. However, you can embed it with some functions if you want to add an additional functionality.
In this tutorial, we will teach you to add a function so that it counts and numbers wordpress comments.
Step 1 – Open Editor
If any alterations are to be done in wordpress functions or scripts, we have to do using the editor.
Thus, open up the editor, go to the Appearance tab and click on the Editor option.
Step 2 – Open Comments File
Wordpress comments are managed in a separate script file. In order to open that, click on the Comments.php option available under the templates section.
Step 3 – Search for a function
Once comments.php opens up, press the “ctrl + F” key and search for a method called “commentlist”.
This is the method which you will have to be modify in order number the comments.
Step 4 – Insert Code
Once you are done, write the code as shown in the figure. After that scroll down to the bottom of the page and click on the Update file button in order to save changes in the configuration file.
Step 5 – Go to the Style Sheet
We will also have to paste a certain code in our wordpress style sheet in order to give some alignment and appearance effects for the comment numbering. In order to do so, scroll down to the bottom of the page and click on the style sheet option available under the styles section.
Step 6 – Insert the code for CSS
Once the style sheet editor opens, scroll down to the bottom and the code shown in the picture below. In this code, we are actually defining the position of the wordpress comment as absolute. We are setting its display position on the top and towards the right as 5 pixels. The font size is 18 and the black color will be used for this purpose. The code below this is responsible for the list of comments and we are just defining its position.
Once you are done, click on the update file button.
Step 7 – Comments got numbered
Now open up your post again and simply refresh the page by pressing the F5 key. You will notice the comment numbers will appear now. In this manner, you can number wordpress comments.
How to Number WordPress Comments
Every blog contains comments. These comments are displayed according to the time of the posts by default. Same is the case with wordpress. However, you can embed it with some functions if you want to add an additional functionality.
In this tutorial, we will teach you to add a function so that it counts and numbers wordpress comments.
Step 1 – Open Editor
If any alterations are to be done in wordpress functions or scripts, we have to do using the editor.
Thus, open up the editor, go to the Appearance tab and click on the Editor option.
Step 2 – Open Comments File
Wordpress comments are managed in a separate script file. In order to open that, click on the Comments.php option available under the templates section.
Step 3 – Search for a function
Once comments.php opens up, press the “ctrl + F” key and search for a method called “commentlist”.
This is the method which you will have to be modify in order number the comments.
Step 4 – Insert Code
Once you are done, write the code as shown in the figure. After that scroll down to the bottom of the page and click on the Update file button in order to save changes in the configuration file.
Step 5 – Go to the Style Sheet
We will also have to paste a certain code in our wordpress style sheet in order to give some alignment and appearance effects for the comment numbering. In order to do so, scroll down to the bottom of the page and click on the style sheet option available under the styles section.
Step 6 – Insert the code for CSS
Once the style sheet editor opens, scroll down to the bottom and the code shown in the picture below. In this code, we are actually defining the position of the wordpress comment as absolute. We are setting its display position on the top and towards the right as 5 pixels. The font size is 18 and the black color will be used for this purpose. The code below this is responsible for the list of comments and we are just defining its position.
Once you are done, click on the update file button.
Step 7 – Comments got numbered
Now open up your post again and simply refresh the page by pressing the F5 key. You will notice the comment numbers will appear now. In this manner, you can number wordpress comments.
Related posts: