Enabling Comments in Pages in WordPress

I have been working with WordPress themes for more than a year now and while most of the time, I am only using the default theme and changing the codes and styles as I want, one question has been circling my mind all this time. How do I enable comments in pages and not just posts?

First, I thought it was not possible. I have been getting quite many pingbacks and trackbacks on pages too but even though I approve them from my admin area, I don’t see anything on the page when I visit it. I never thought twice of what might be the cause. I always thought, well its not possible in pages.

Anyway, I just got a question from Kurt about this and a few times earlier. I never looked at the possibility but had this in mind, maybe the page doesn’t have comment template function call. I didn’t look at the code fully. Page.php was always what it was.

So, I just had some time and looked at page.php. Indeed, this was pretty simple. I compared with single.php and I didn’t see comment template call on page.php. I did a quick testing by putting this code:

<?php comments_template(); ?>

and saw the the page. Voila, there it was!

So, if anyone else is having this very problem of “how to enable comments on pages”, here is what you have to do. Put this code

<?php comments_template(); ?>

right before your closing content div. So, the code might look something like this:

<?php get_header(); ?>

<div id="content">
<?php // all page content goes here ?>
<?php comments_template(); ?>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

I would love to know if you have any other ideas about how to enable comments on pages. This might not be so important since Pages aren’t there for commenting in the first place. I guess thats why the default themes (or most) doesn’t have this enabled.

Comments (3)

  1. help me, please!!! im trying to make a wide page template for simpleX but i haven not sucess. i try to change the css and the divs in page.php (i create the page-1colunm.php) but the posts/entries are crashed/truncated… can you help me, please!!?
    thanks

Trackbacks/Pingbacks

  1. untell.com