WordPress.org

Ready to get started?Download WordPress

Forums

How to Add Comment Box in Specific Pages (7 posts)

  1. tanji
    Member
    Posted 4 years ago #

    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

  2. tanji
    Member
    Posted 4 years ago #

    Plz reply to help me guys...

  3. vtxyzzy
    Member
    Posted 4 years ago #

    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:

    <?php
      if ( in_category(array(4,55,201))) {
         comments_template();
      }
    ?>

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

  4. tanji
    Member
    Posted 4 years ago #

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

    <?php get_header(); global $wp_theme_options; ?>
    <?php do_action('before_content'); ?>
    
    <!--page.php-->
    <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">
    
    	<!--Title-->
    	<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>
    
    	</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>
        </div>
    
    	<?php endif; // do not delete ?>
    
    </div><!--end #content-->
    
    <?php do_action('after_content'); ?>
    <?php get_footer(); //Include the Footer ?>
  5. buddha trance
    Member
    Posted 4 years ago #

    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-->

  6. vtxyzzy
    Member
    Posted 4 years ago #

    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.

  7. ingenieouspundits
    Member
    Posted 4 years ago #

    @ 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.......

    Regards
    Mujeeb Maktedar

Topic Closed

This topic has been closed to new replies.

About this Topic