Support » Fixing WordPress » How to Add Comment Box in Specific Pages

  • tanji


    Dear sir,

    I have a cms site with around 500 pages but no post.I use wordpress 2.8.6 version and want to put comment box only in some specific pages. I do not have skill on coding.So is there any plugin by which i can add comment box only in some particular pages?

    I used paged-comments but that does not show in my admin pannel and may not be useful to add comment box in SPECIFIC pages. Please advise

Viewing 6 replies - 1 through 6 (of 6 total)
  • tanji


    Plz reply to help me guys…



    I know you said no coding, but I couldn’t find a plugin to do what you want. The coding is fairly simple, but BACK UP your site first if you decide to try this.

    Go to the Admin panel in your site and select ‘Appearance->Editor’.
    Click page.php in the right sidebar.
    Locate this line near the end of the file:

    <?php comments_template(); ?>

    and change it to:

      if ( in_category(array(4,55,201))) {

    Replace the numbers 4,55,… with the numbers of pages to allow comments.
    Click ‘Update File’, and try it out.



    Sorry dear.I dont find that.Here is my page.php code:

    <?php get_header(); global $wp_theme_options; ?>
    <?php do_action('before_content'); ?>
    <div class="<?php do_action('content_style'); ?>" id="content">
    	<?php if (have_posts()) : while (have_posts()) : the_post(); // the loop ?>
    	<!--Post Wrapper Class-->
    	<div class="post">
    	<h3 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h3>
    	<!--post text with the read more link-->
    	<?php the_content(); ?>
    	<!--post meta info-->
    	<div class="meta-bottom wrap">
    	</div><!--end .post-->
    	<?php endwhile; // end of one post ?>
    	<?php else : // do not delete ?>
    	<div class="post">
    	<h3><?php _e("Page not Found"); ?></h3>
        <p><?php _e("We're sorry, but the page you're looking for isn't here."); ?></p>
        <p><?php _e("Try searching for the page you are looking for or using the navigation in the header or sidebar"); ?></p>
    	<?php endif; // do not delete ?>
    </div><!--end #content-->
    <?php do_action('after_content'); ?>
    <?php get_footer(); //Include the Footer ?>
    buddha trance


    What you can do is create a template for pages with comments, and then you go to edit the pages you want the comments on, and from there you go to “Attributes” (below the “Publish” field) and from the drop down menu you select the “Enable Comments” template.

    To create the template, make a duplicate of page.php and rename it page-comments.php

    At the very top before the duplicated code, add

    <?php /*
    	Template Name: Enable Comments
    */ ?>

    Then, insert the following

    <?php comments_template('',true); ?>

    try putting it before
    </div><!--end #content-->



    OK. Apparently the theme you are using has a function in functions.php called after_content that handles the comments.

    Sorry I couldn’t help.

    @ Budda trance …. thanks the script you have mentioned have helped me a lot….. I had inserted it on my page.php file and i can see the comment box appearing there now…… thanks…….

    Mujeeb Maktedar

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to Add Comment Box in Specific Pages’ is closed to new replies.