Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Pseudo code might look like:

if it's this type of post
    display comments and comment box
otherwise 
    forget it

This same type of code should also allow someone to have HTTP requests if it's some page, or some kind of page/post but not all of them.

share|improve this question
    
Hi Daniel, please, instead of some requirement, present us your research and attempts to solve the issue yourself. See How to Ask. –  brasofilo May 12 '13 at 5:05
    
You have to put some fixed criteria, how you want to filter the comment box. It can be of certain category/categories, or other taxonomy types; can be of certain post type; can be of certain author... so first come up to this point, then your answer will follows. Thanks. –  Mayeenul Islam May 12 '13 at 18:32
add comment

2 Answers

In principle you should be able to achieve that by using categories for your posts. So while your normal loop for the single.php might look like this (I'll just leave the markup I had in there since I took this out of a file I had lying around. It may of course be different from yours.)

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php the_title(); ?>
    <p><em><?php the_date(); ?>, <?php the_time(); ?></em></p>

    <?php the_content(); ?>
  <small>Permalink: <?php the_permalink(); ?></small>

    <hr>
    <?php comments_template(); ?>

<?php endwhile; else: ?>
    <p><?php _e('Sorry, diese Seite existiert nicht.'); ?></p>
<?php endif; ?>

You would get another another if to check if it's in the category. It should more or less like this Codex article.
So you'll just have to put the posts in question in a "no comments" category and make sure that this category is displayed without the

<?php comments_template(); ?>

part of the loop. I think you should be fine then.

share|improve this answer
add comment

In the loop you should check for the post type, so something like:

if (get_post_type() == "Your_Allowed_Post_Type"){
    comments_template();
}else{
    //No COMMENTS HERE , show what you want..or nothing :)
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.