wordpress display post comment number

To display the comment number for a post in WordPress, you can follow these steps:

  1. Open the WordPress theme files:
  2. Log in to your WordPress admin panel.
  3. From the sidebar, go to "Appearance" > "Theme Editor".
  4. Select the theme file you want to edit (e.g., "single.php" or "content.php").

  5. Locate the post loop:

  6. Look for the code that starts the loop for displaying individual posts.
  7. Typically, you will find a line like <?php if (have_posts()) : while (have_posts()) : the_post(); ?> or similar.

  8. Add the comment count code:

  9. Inside the loop, find the section where the post content is displayed.
  10. Add the following code to display the comment count: <?php comments_number(); ?>.
  11. You can also customize the output by passing parameters to the comments_number() function. For example, <?php comments_number('No comments', '1 comment', '% comments'); ?>.

  12. Save the changes:

  13. After adding the code, click on the "Update File" button or save the changes for the edited file.

By following these steps, you should be able to display the comment number for a post in WordPress.