OSN Header

WordPress: Copy My Comments Page

I’ve gotten a lot of comments about how I do my comments page and figured I would share how I do it! Granted not all of the styles are in my style sheet, that is due to pure laziness on my part when I was writing it up.

I use the following WordPress plugins specifically for the comments page:

For the rounded edges I use the following CSS3:


This chunk of code enables you to have alternating colors in the comments but also let’s you define in your CSS, a class to specifically customize the author (your) comments.

Place at the very top of the page, this defines the CSS class you will use for the alternating color row in your comments.

$oddcomment = 'alt';

This also starts the comment loop.

<?php if ( have_comments() ) : ?>
<?php $i = 0; ?>
<?php foreach ($comments as $comment) : ?>
<?php $i  ; ?>
//Test for author comment
if($comment->user_id == "1") {
$authorcomment ='me';
$commentclass = $oddcomment . ' ' . $authorcomment;
$authorcomment = '';
$commentclass = $oddcomment;
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type == 'comment') { ?>

This post is over a year old which means the content may be outdated or no longer accurate.

Subscribe to Weekly Posts & snippets


Link CSS Changes

In post content only, I now have external links with a little arrow and made affiliate links orange plus the arrow. I feel like that will, hopefully, make things clearer visually if a link is affiliate, external, or internal.

Spring Equinox

A blessed Ostara / Spring Equinox / First Day of Spring to you!

Small OSN Refreshes

Changed the following to OSN:

Click to Skip to comment form

posted on January 17th 2010 at 3:30AM CST

thanks. i really like how your comment form includes a box for twitter id and i had downloaded the plugin but couldn’t figure out how to make it look nice. being able to see your code i’ll be able to get it worked out.

posted on January 17th 2010 at 6:12AM CST

Thanks so much for the tip on how your comments page is formatted with the Twitter ID!

What a great idea

posted on January 17th 2010 at 6:49AM CST

Wow thanks for sharing hun :)

posted on January 17th 2010 at 6:58AM CST

Can I use it at digital-damita.net?? Also I can’t seem to get cufon keeps saving that I haven’t choose a font when I have any ideas?

posted on January 17th 2010 at 11:55AM CST

@Carrie also remember that you can style your form elements to make it look even better! I like the twitter field since twitter is so prevalent these days.

@FB you are so very welcome! I like to think I do things slightly differently around here, at least enough so that when I do posts like this, it helps someone out!

@Damita with Cufon 1. are you converting the font properly 2. putting the font.js file in the proper place

Of course I would prefer you customize it a bit/link back for credit, remove my img link lol but of course you can use it!

posted on January 17th 2010 at 1:58PM CST

any ideas how to get it to save the twitter id if it’s been previously entered so that it already shows up as filled in?

posted on January 17th 2010 at 2:16PM CST

@Carrie you would manually have to do that via say PHPmyAdmin or enable cookies OR if you use firefox for your browser, I like the easyComment addon.

Generally most browsers should save entered form information so that it shows up automatically.

posted on January 17th 2010 at 3:23PM CST

i use firefox and it saves all the other fields but not the twitter id

posted on January 18th 2010 at 12:35PM CST

I love this, thank you! I only have one question – how do you get your comments to be a different color than everyone else?

posted on January 18th 2010 at 5:29PM CST


posted on January 19th 2010 at 7:51PM CST

@Carrie I tried to duplicate the issue you’re having with the twitter id on my box and sure enough firefox saved the field for me. I wonder if it’s a cookie issue or something perhaps?

@Caitlin I explained in the entry on how to have it set a special CSS class for the author of the entry, it’s all contained as well, in the comments.txt file.

@Caity you are very welcome!

posted on January 19th 2010 at 11:38PM CST

Thanks Sarah, I think I missed it. That’s what happens when you try to play around late at night ;)

posted on January 31st 2010 at 9:15PM CST

Comments. Jeesh. This section alone has taken up most of my attention during the last 3 days of my theming time.

I looked at your comments.txt (is this your comments.php renamed for viewing?) and I don’t recognize a bit of it.

What I’m working on (just for styling the comment area) is the setup from here:

Q1 – how/where do YOU classes to the php/html for your comment area?

Q2 – “how do I style the twitter id field once it’s displayed in the comments area?” – and/or “how do I tell WP ‘the info from this twitter form should be given this styling class’?”

Your id’s and classes in your comments section (I checked them out with firebug :) are basic and descriptive – the ones I’m working with suck. And I can’t really “see” what info it’s getting from the db, I just have to crap around w/Firebug and “reverse engineer” my styling.

wp_list_comments is what I have in my comments.php that actually “brings” the HTML output – and I can’t find any other location in my WP install that contains the rest of the mystery – do you use wp_list_comments or are you “rolling your own” comments page via php commands you’ve specified?

PS – not going to make my Feb 1 deadline. bah. it’s not for lack of effort, though.

posted on January 31st 2010 at 9:36PM CST

…and now that I’ve spent ~1 hour searching for the answer and typing the above comment, I seem to have figured it out for myself by just tinkering w/ the plugin settings. jeesh.

Sorry if you got excited about the chance to answer all those questions, you may proceed if you’d like (I am curious how you’ve done the back-end class designations) but it’s no emergency, I can continue to live in ignorance – it’s not like I don’t have more to sort out. ha.

posted on February 1st 2010 at 9:15AM CST

@Tom yep that is my comments.php! I think mine are more “descriptive” because I coded from ground up. Everything for the most part is in my CSS, with the exception of lazy coding when it comes to areas like the “stay up to date” for example.

I do NOT use wp_list_comments but have each section broken down. So author here, avatar there, comment over there… etc.

posted on July 12th 2010 at 6:38AM CDT

I’m glad I read thru all the comments here. I thought I was the only person left in the blogosphere NOT using wp_list_comments.

posted on July 12th 2010 at 7:36AM CDT

I actually made a custom function now so technically I NOW use wp_list_comments but with the same stuff as in that text file up for grabs.

So in my CURRENT comments.php I pull it as such

<?php wp_list_comments('style=div&

callback=osn_comment'); ?>
posted on February 10th 2010 at 5:29PM CST

ONE more question – how do you get the ” t ” twitter icon in front of the commenter’s twitter id link?

I tried setting it up on the twitterlink plugin page, and I keep getting the message “Some HTML tags were stripped (not in list of allowed tags)”

posted on February 11th 2010 at 10:35AM CST

@Tom, I actually edited the plugin to do that.

posted on July 30th 2010 at 1:32PM CDT

I love your comments page, its gorgeous! I’d love to know how to have the same set up except with different colors…. or maybe the colors do go with my site i dont know..
the only change I would make is that I wouldn’t want the postcard part, i would just want a white box. Your site is such a valuable resource and i am so glad i found it! (from the problogger sitsgirl challenge).

My wordpress site isn’t live, its still in the test stage.. I’d love your help though! :)

posted on July 30th 2010 at 3:00PM CDT

Thank you! Well this entry basically offers a download to “copy” what I’ve done with my comments page.

Feel free to ask any questions and if you need help with anything, I am available for hire!

Leave a Comment

Thank you for your comment!
Read the Comment Policy.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Previous Post -
Newer Post -

Powered by &
privacy policy / disclaimer