Numbering Comments
-
So, I’ve taken a different stance with my comments lists on my new theme, but I’m having just a *teensy* issue here. What I’m doing is chucking the
<ul><li>stuff for listing comments people have placed. I’m doing a more stylistic version instead, where the actual comment number is set as a kind of background to the comment instead.You can see it in action here: scroll to the bottom and you can see the two comments, and how the background has the numbers in it.
Now, the thing is, if you notice in that post that the numbers are actually “3” and “4” – not “1” and “2”. If you look through other posts it’s the same – it appears that it’s taking the actual comment ID and putting that in the background – so it’s showing the comment ID for the whole *site*, not just for the post at hand.
Of course, I look back at my code and smack myself in the head, because that’s what I *told* it to do. Duh. My code looks like this:
<?php foreach ($comments as $comment) : ?> <div class="comment<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>"> <div class="number"><?php echo comment_ID(); ?></div>Now, the “number” div is what holds the actual number you see in the background. I’m using the “comment_ID” – which is why it’s showing the numbering system the way it is. Is there a way to change that so it shows the correct numbers for each *post* – not for the site on the whole?
Hopefully that makes sense!
The topic ‘Numbering Comments’ is closed to new replies.