How to enable comments to pages in WordPress

Leave a comment

By default most WordPress themes are not enabled to allow comments on pages. So even if you check the “Allow comments” check box in the DISCUSSION section when creating a page, nothing will happen until you edit your Page template file. You can ether edit it by logging into the the wp-admin site or by editing the file via ssh or ftp.

If you use the wp-admin site, click “Appearance” on the left side of the window to expand the section, then click on “Editor”

Make sure your current theme is displayed on the right hand side where it says “Select theme to edit:”
If it is, then click on the “Page (page.php)”

If you are using the FTP/SSH option go to your wordpress installation directory.
Then navigate to wp-content > themes > {your theme} and edit page.php

Scroll down until you see the following line of code:

<?php if (have_posts()) : while (have_posts()) : the_post(); } ?>

Then add the following line:

<?php if ((‘open’ == $post-> comment_status)) { comments_template(); } ?>

And it should be added before this line:

<?php endwhile; endif; ?>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s