WORDPRESS: Disable comments in “News” Category and Enable in “Blog” Category?

I have a News page that displays all the posts within the “News” Category. This category has sub-categories such as “Merchandise, Music, Events” ect.

I am aiming to remove comments from ALL News/Sub-category posts but only display them with the “Blog” Category posts.

Read More

Right now I have my single.php set up so posts with the “Gallery” post_format structure are displayed differently.

Here is the single.php file//
http://pastebin.com/YNf3TxT6

I am wondering what I have to fix in order to get this working…

Related posts

Leave a Reply

1 comment

  1. Edit: For future viewers, here is the updated paste from the conversation below for a single.php that will only show the comments template if the post is in the “Blog” Category: pastebin.com/y9ZtCN5U

    Assuming you put your Blog posts on a page separate from your news posts, you should be able to use different templates based on category.

    http://codex.wordpress.org/Category_Templates

    So, you could make a category-blog.php template file that doesn’t include the comments code.

    If all of your categories are being listed on the same page, use this instead of the in_category stuff on line 50.

    <?php
    foreach (get_the_category() as $category) {
        if ( $category->name == 'Blog' ) {
            comments_template();
        }
    }
    ?>
    

    Not 100% sure that will work, but try it out and let me know what happens.