WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Disabling comments for a certain category. (4 posts)

  1. pauljohns
    Member
    Posted 6 years ago #

    Hello. Does anyone know how to disable comments for one category only?

    Thanks in advance.

  2. Chris_K
    Member
    Posted 6 years ago #

    One option: Consider making 2 Category_Templates. One named archive.php and one named category_x.php, where "x" is the id of the category you don't want to have comments.

    The two files could be identical except that archive.php would have the comment code and category_x wouldn't.

    Follow that link for category_templates to learn more. A glance at Template_Hierarchy probably wouldn't hurt either. :-)

  3. pauljohns
    Member
    Posted 6 years ago #

    Thanks, I will. Thank you very much.

  4. seg
    Member
    Posted 6 years ago #

    If you are wanting to display past comments, but turn off future comments. In the comments.php file you can use conditional statements (if, else) and the in_category() function to detect the category. By doing this the previous comments will display and for the categories with closed comments you can add a message notifying the reader that the comments have been closed.

    One more idea in case it helps!

Topic Closed

This topic has been closed to new replies.

About this Topic