How to enable comments on Wordpress Pages?
Wordpress February 1st, 2008You can use wordpress as a simple Content Management System for a non-blog website. That’s what I am doing on one of my other websites. But I wanted to enable comments on my static pages. I figured just by enabling “Allow comments” under “Discussion” did not work. Then I found this wordpress.org thread
All you need to do is edit the “Page Template” and insert the following code
<?php if ((‘open’ == $post-> comment_status)) { comments_template(); } ?>
somewhere in between the following two lines.
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php endwhile; endif; ?>




February 11th, 2008 at 5:42 am
By page template, do you mean the page.php file in your theme? You also said somewhere in between the 2 lines, does it matter where? I followed what you said and I still can’t get it to work.
February 12th, 2008 at 10:51 am
Frost, i do mean page.php file. anywhere between the lines is fine. something like below in your page.php should work.
< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>
/* All other stuff */
< ?php if ((‘open’ == $post-> comment_status)) { comments_template(); } ?>
< ?php endwhile; endif; ?>
February 14th, 2008 at 6:47 am
I got it to work…sort of. I had to use this code “” and add a closing dev tag to get it working. Do you know if the code you said and the one I used do anything different?
February 14th, 2008 at 10:43 am
I realized it be could be because of the wordpress theme that you are using (although, i think it’s less likely). I tried this using the “Almost Spring” theme.
February 23rd, 2008 at 12:10 pm
[…] most helpful post was : THERE […]
February 25th, 2008 at 10:54 am
hi there. i figure your post / content out. but i dont get a good result on my site. what have i to do.
I followed what you said and I still can’t get it to work.
any solutiuon there ?? thanks
February 25th, 2008 at 11:09 am
Try doing what Frostfox did in comment # 3. Hope that works.
March 10th, 2008 at 9:52 pm
Here’s the code I used on the default template and it works beautifully. Thanks for the post.
<div class="post" id="post-">
<?php the_content('Read the rest of this page »'); ?>
'Pages: ‘, ‘after’ => ”, ‘next_or_number’ => ‘number’)); ?>
comment_status){comments_template();} ?>
<?php edit_post_link(’Edit this entry.’, ”, ”); ?>
April 20th, 2008 at 2:20 am
not work on my wp. Wp 2.5
April 20th, 2008 at 2:33 am
sorry, its work now. thank you