how to add a comment button to be displayed only for the posts in the home page [closed]

In the template part used in the loop on your home page, something like this should get you started. Someplace after the_content(); or the_excerpt(), depending on what you’re using.

<?php
  if ( is_home() ) { ?>
    <a class="button" href="<?php echo esc_url( get_permalink() );?>#comments">
      Comment Link Text
    </a>
  } 
?>

You can make it look like a button with CSS from any of the 80,000 CSS button generators online.

Two things to note:

  1. The conditional is_home() depends on your blog’s set up. You might need is_front_page(). Check the codex or “Tip: is_home() vs is_front_page()”. It’s possible you wont need it at all if the theme developer already has something like a content-home.php set up.
  2. The appended #comments fragment identifier will need to be changed to match your single.php comment container’s ID.