How to show comment numbering?
-
A link to your site might help…
It is possible to show comment numbering without plugin?
For example inove theme has this feature. ThanksI have default theme Kubrick and WP 2.9.1
Nobody knows? :o)
i m looking for same 🙁
Hi,
Refer this article:
http://codex.wordpress.org/Template_Tags/comments_number
Otherwise:
Open comments.php and find this the lines that look similar to this:
<ol id="commentlist"> <?php foreach ($comments as $comment) : ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>"> <?php echo get_avatar( $comment, 32 ); ?> <?php comment_text() ?> <p><cite><?php comment_type(_c('Comment|noun'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p> </li> <?php endforeach; ?> </ol>
Now all you need to do is change it to this:
<ol id="commentlist"> <?php $i = 1; ?> <?php foreach ($comments as $comment) : ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>"> <?php echo get_avatar( $comment, 32 ); ?> <?php comment_text() ?> <p><cite><?php comment_type(_c('Comment|noun'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p> <div class="commentnumber"><?php echo $i; ?></div> </li> <?php $i++; ?> <?php endforeach; ?>
After that, open up your style.css and add something like this:
.commentnumber { position: absolute; right: 5px; top: 5px; font-size: 18px; color: #efefef; } .commentlist li { position: relative; }
Thanks,
Shane G.
i’m on 2.9.2 and i don’t seem to have this foreach.
any other ideas? thanks!
Why not just set the comments list elements to number, would only require a small CSS update. Usually comments are output into a list, if that’s the case it’s a matter of switching
list-style:none
tolist-style:decimal
on the appropriate style (and maybe tweaking the CSS a little).Without a link to the site i can’t provide a more definitive suggestion sorry.
that worked perfectly – and the funny thing is i tried that before seeing your comment!
funny how hours of research and trying to find “hacks” sometimes end up having such a simple solution!
thank you.
@ shane
thanks for your reply. But each comment is displaying 15 times….. any other solution? pls
- The topic ‘How to show comment numbering?’ is closed to new replies.
(@natart)
14 years, 3 months ago
Hi,
How do I make my comments so it shows it like this..
#1 Author
Comment Text
#2 Author
Comment Text
#3 Author
Comment Text
#4 Author
Comment Text
so it shows the number index of the comments?
thanks.