• kenm37

    (@kenm37)


    I’m looking for a way to disable comments per category. Is there a simple way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • phe.le

    (@phele)

    Yes, it is very simple. Just duplicate the single.php and rename it to something else. For example, single1.php, then remove <?php comments_template(); ?> from it.

    Use this code:

    <?php
      $post = $wp_query->post;
    
      if (in_category('1')) {
          include(TEMPLATEPATH.'/single1.php');
      } elseif (in_category('2')) {
          include(TEMPLATEPATH.'/single2.php');
      } else {
          include(TEMPLATEPATH.'/single.php');
      }
    ?>

    [Please post code snippets between backticks or use the code button.]

    Make sure you replace the category number above.

    Thread Starter kenm37

    (@kenm37)

    Thanks…. Let me try to umnderstand and learn.
    I copy single.php to single1.php. Then I delete <?coments_template();?> in single1.php and replace it with the above code.(?) change tho catagory ID to the catagory that I want to block comments? then I do the same for all catagories in want to block comments from? I think…

    Thanks for all this help..

    Ken

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Comments and catagories’ is closed to new replies.