How to add comments field to pages in WordPress

WordPress core is designed to allow the comments field on both pages and single posts but not every theme goes the distance and actually includes the code to make it happen… Thankfully it really isn’t that hard to add the code yourself. By adding this single line of code to your Page Template (page.php) it should begin working:

  1. Add the line <?php comments_template(); ?>
  2. In the default theme it fits well just before the closing </div> for the <div id=”content”>. A little trial and error should get it working, you can also study your Single Post (single.php) theme and include surrounding content.
  3. Once you add the code to the page.php template save it and then visit each page in your editor to turn comments on/off

As mentioned above, you can control which pages allow comments by checking the Allow Comments check box under the Discussion bar as shown in the image below.

You can also edit the comments.php file and add <?php if (!is_page()) { ?> before the line that reads <!– If comments are closed. –> and <?php } ?> after it. This will stop the “Comments are closed” message from appearing on pages.

In my theme it looks like this:

<?php if (!is_page()) { ?>
<!– If comments are closed. –>
<p>Comments are closed.</p>
<?php } ?>