• I’m looking to add comments to the archive.php so that each category listing will have its own unique set of comments at the bottom of the page after listing all the matched posts for that category. I don’t want the comments to be in the posts themselves, but on the category page for a category like “news”. I’ve looked all over and couldn’t find anything about whether this is possible or not.

    Anyone done this before? If so, how?

Viewing 8 replies - 1 through 8 (of 8 total)
  • You have really got me thinking on this one. The comments are normally linked to a specific article. What you are proposing means that you will be listing a few articles and then show the comments for any of the articles that have just been listed. I just cannot think of a way of managing this. Maybe I am missing something here and someone else actually has a solution for you.

    don’t know your theme but play with it
    add this line to archives.php after all the content/past stuff
    <?php comments_template(); ?>
    back up 1st of course

    Thread Starter joshuatuscangmailcom

    (@joshuatuscangmailcom)

    What I’m going for is to have comments for the archive.php individual of any comments that are on the posts displayed on that archive.php page. So if the archive.php display all posts for the category “News”, I want a user to be able to comment on that page, not on the posts. Comments about the “news” category.

    Thread Starter joshuatuscangmailcom

    (@joshuatuscangmailcom)

    Adding <?php comments_template(); ?> to the archive.php doesn’t work.

    The only way that this could work is if you call the comments template within the loop that actually fetches the articles in the specific category. This means that you will get an article, then its comments, then the next article with its comments etc. I do not think that this is what you are looking for. A page like this could get quite unwieldy.

    I am assuming you want all the articles listed in the relevant category with all the comments for these articles below the list of articles. Here you will have a problem as the comment template will be looking for a single specific article for which to return the comments. All the comments template will do in this scenario is to return the comments for the last article listed in the list of articles.

    I guess what you’re into is creating a custom Page template. This would run your custom categories loop, or paste a copy of the loop from archive.php. You can enable comments on Pages (they’re allowed by default).

    Once you’ve made your custom category template, create a new Page in Admin, and select your template’s name from the drop-down (the templates option doesn’t show until you have added at least one template). Make sure ‘allow comments’ is checked.

    Any comments posted would attach to the Page, not the category posts within it.

    I am also looking for a way to archive comments, in this case comments on a page. This page hosts a very popular live web cam of a pair of nesting barn owls. It is now getting about 100 comments per day (chicks are hatching), almost 10k total since we started a year ago. This finally caused a php memory error to display within the recent comments until I disabled several older ones. Of course I can bump up the memory, but what I’d like to do is separate out last year’s comments and link them from a separate page. I realize this is probably an unusual situation and nobody has written a plugin for it, so I guess I’ll try going into phpMyAdmin, finding the field that associates a comment with a particular page, and changing the 2009 comments to display on a different page. Tips or suggestions are welcome

    Wondering if anyone has figured this out? I’m doing sort of the same thing except with tags. Have all my ‘posts’ on my tag pages and looking to let people comment on the ‘tag’. Sort of like a review for that tag.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Adding comments to archive.php’ is closed to new replies.