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; ?>
Related posts:
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
October 21st, 2008 at 6:36 am
[...] Re: PS3 "Dofollow" Blog – Get Your Backlinks Now! How to enable comments on Wordpress Pages? [...]
October 26th, 2008 at 7:21 am
Hmm, couldn’t get this working at all using ClockWorkMint theme but, editing the index.php page of that theme and replacing:
with
and
with
did the trick. My knowlegdge of php is limited to edit and pray but this worked OK for me
November 12th, 2008 at 2:19 am
Thanks a bunch Devang. Worked like a charm:)
December 20th, 2008 at 7:38 pm
Devang, your trick didn’t quite work for me, edited out to include only and that worked fine, thanks
December 20th, 2008 at 7:39 pm
Oops, I meant to include comments_template();
January 11th, 2009 at 10:23 pm
Double Quotes worked for me on a customised Template, using the PAGE.PHP, placing it in the position you stipulated :
comment_status)) { comments_template(); } ?>
thanks, you saved my non-interactive blog!
January 19th, 2009 at 9:16 pm
Just a TIP.
If you want it to work… DO NOT COPY PASTE the code, TYPE it!!! or else, it won’t work.
You can also just retype these symbols (‘)
January 28th, 2009 at 5:23 am
I had to do this for another blog, so thought I would repost the instructions that worked for me since it did not print out completely in my last post. Here is the last 3 lines of where I inserted Devan’s code into the PAGE.PHP :
_____________________________________
comment_status)) { comments_template(); } ?>
______________________________________
If you need to adjust the size of the comment box (mine was overflowing on the right), change the stylesheet, STYLE.CSS file. Scroll right to the bottom, I changed mine from 100% to 400px.
_______________________________
#commentform textarea
{
width: 400px;
padding: 2px;
}
_____________________________
Thanks so much for this Devang, I use it over & over!
January 28th, 2009 at 5:25 am
Misprinted again, try again, ignore asteriks (sigh)
___________________-
*** comment_status)) { comments_template(); } ?>
_______________________
January 28th, 2009 at 5:27 am
Devan, just delete these 2 comments, I cannot get the code you stated to display correctly in the comments, sorry, Joelene
February 14th, 2009 at 8:34 pm
Thank You!
Instead of single quotes all you have to do is use:
comment_status)) { comments_template(); } ?>
To admin: please revise the original post to include the double quotations.
February 14th, 2009 at 8:36 pm
For some reason the above comment by me deleted half the code. Anyway just use the double quotes instead of the single.
March 26th, 2009 at 11:26 am
Worked. Thanks.
May 13th, 2009 at 11:43 am
thanks mate.. really works. just copy the code and replace the ‘
May 13th, 2009 at 8:52 pm
Hi – I tried this on my custom theme:
comment_status)) { comments_template(); } ?>
didn’t work. BUT this works:
comment_status)) { comments_template(); } ?>
What’s the diff? Single vs. double quotes around “open”…
June 5th, 2009 at 7:01 pm
I had to edit page.php and use double quotes “” around open for example “open”. After doing that it worked.
Thanks
June 10th, 2009 at 10:12 am
I don’t usually reply to posts but I will in this case. WoW
June 11th, 2009 at 6:29 am
Thank you for your help!
June 12th, 2009 at 3:48 pm
The best information i have found exactly here. Keep going Thank you
July 4th, 2009 at 8:36 am
this actually worked on my custon template
comment_status)) { comments_template(); } ?>
NOTE the double qoute marks on “open”
that did the trick
thanks folks!!
July 4th, 2009 at 8:37 am
comment_status)) { comments_template(); } ?>
CODE CUT OFF
this is the full line of code I put it in-
thanks again
August 26th, 2009 at 11:34 pm
this works for me after change `open` to ‘open’
Thanks!
November 12th, 2009 at 12:12 pm
THANK you!
February 10th, 2010 at 9:33 am
So I am really new to this and I cannot get this to work. When you click on the leave a comment to takes you to a page that say: “404: Page Not Found
We are terribly sorry, but the URL you typed no longer exists. It might have been moved or deleted, or perhaps you mistyped it. We suggest searching the site:”
do you have anything I could try? is it the theme template I am using?