How to Replace WordPress Comments Count Number and Text
Today we are going to see how to replace the wordpress comments count number and text with just a few lines of code. Sometimes our clients demand us to change wordpress comments text like [0 Comment] to [0 Comments]. But there is no such plugin available to make these changes. So, we have to do hard code for this change. Also, make sure you have knowledge about PHP, WordPress Hooks, Functions otherwise you will break your site and we are not responsible for this. Without the proper knowledge, there is a 100% risk for your site. If you are a beginner and don’t want to take that risk then we will suggest you hire someone else or hire our experienced web developer. We also provide web development services. So, you don’t need to find someone else in the marketplace just Contact us through our website we will get in touch with you within a few minutes.
First of all, before we make any changes we need one plugin called Code Snippets. After installing it please activate it. Then go to Snippets
After that click on Add New and give a title name. Example: Replace WordPress Comments Counts and Texts
Then apply the below codes and make changes based on your client’s requirements.
add_filter ('comments_number', 'wpcodersclub_comments_number', 10, 2);function wpcodersclub_comments_number ($output, $number) {if ($number == 0) $output = '0 Comments';elseif ($number == 1) $output = '1 Comment';else $output = $number . ' Comments';return $output;}
We are going to help you to improve your wordpress coding skills throughout our experience.
0 Comments