WordPress.org

Ready to get started?Download WordPress

Forums

Adding comments to archive.php (9 posts)

  1. joshuatuscan@gmail.com
    Member
    Posted 4 years ago #

    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?

  2. Arnold Goodway
    Member
    Posted 4 years ago #

    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.

  3. Samuel B
    moderator
    Posted 4 years ago #

    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

  4. joshuatuscan@gmail.com
    Member
    Posted 4 years ago #

    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.

  5. joshuatuscan@gmail.com
    Member
    Posted 4 years ago #

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

  6. Arnold Goodway
    Member
    Posted 4 years ago #

    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.

  7. iamzippy
    Member
    Posted 4 years ago #

    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.

  8. webmystery
    Member
    Posted 4 years ago #

    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

  9. gcarson
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic