PDA

View Full Version : Something I recently noticed about wordpress comments



the goat
01-21-2009, 11:37 PM
It might be getting to the point where wordpress needs its own sub forum.

Well here is my latest pet peeve. I have one site where there are lots of members who like to comment, it has almost reached social network levels. One of them brought it to my attention that you can not access comments from certain navigation points.

For instance if you search for a post, or if you link to it from the archives you can neither see nor add to the comments. I have remedied it, but only halfway. I was hoping to have any post always display the comments and the comment box by adding this code to the archive.php and search.php files:


<?php comments_template(); ?>

When that didn't work I tried to see if I could at least get the amount of previous comments display so there would at least be a link there. To my surprise this did work. Here is the code:


<?php comments_popup_link('Comment', '1 Comment', '&#37; Comments'); ?>

I put that inside both the search.php and the archive.php files directly under this existing code:


<div class="category"><?php the_category(', '); ?> </div>

This way no matter how someone finds a post they can still comment on it.

I have no idea if this is the best way to do it, but I thought I would post it in case anyone else had a site that comments were popular on. I found that my category links all direct to the archives, so even new posts were sometimes being seen with no way to comment. Hopefully someone finds it useful.

vangogh
01-22-2009, 02:00 AM
I was thinking the same thing about a WordPress subforum. As soon as I find a little time to create it and move some threads in, I'll start setting it up.

When you say you couldn't see the comments do you mean on the search or archive page itself or when you click the link from either of those pages to see the single blog post page?

It doesn't really make sense to see the comments on the search results page or the archives page since you're generally not seeing the full post, but if you click the link that takes you to the single post page you should still see the comments. By default the search and archive pages should show how many comments the post has with a link directly to the comments.

The solution you found is how the default theme is set up so I'd say you found a good way.

I think the reason why the comments template wouldn't work is because it needs to know which post it should display comments for, but on the search and archive pages there's more than one post. Most people won't display the full post on those pages so it doesn't really make sense to have them comment there.

vangogh
01-22-2009, 02:09 AM
It didn't take too long so I created the WordPress subforum and moved all threads with WordPress in the title into it.

the goat
01-22-2009, 03:11 AM
Good stuff, I could remember you saying it would become clear when it was time to expand, I guess you were right.

Hmmm... You are right, a few of my themes do show the number of comments in the archives and search results and a few don't. This particular one did not. Well at least I got the fix right! Here I was all proud of myself.

vangogh
01-22-2009, 10:52 AM
I guess your theme decided not to include them, but good that you figured it out easily enough.

Yeah that's how I figure new subforums will grow. People start enough threads on a topic and next thing you know we'll have a new subforum.

Harold Mansfield
01-22-2009, 01:28 PM
It didn't take too long so I created the WordPress subforum and moved all threads with WordPress in the title into it.

I love it ! Great idea !

vangogh
01-22-2009, 03:06 PM
I had a feeling the new subforum would go over well with at least some of us.