Feedback

Styling Your Wordpress Comments

A fun part of customizing Wordpress themes is designing a comments format which complements the rest of the site. Here are three examples from recent projects, including code samples and downloads to the original .PSDs:

  1. Green Gravatars

    This comment style was part of a very green-and-beige environmental blog which since received a makeover. It requires the gravatar plugin and three different images: the scanlines, the clock and the gradient, which can be exported from your .PSD.

    First, we’ll need to first edit the ordered-list section of the “comments.php” template:

    <ol class="commentlist">
    <?php foreach ($comments as $comment) : ?>
    <li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
    <cite>
    <img src="<?php gravatar("R", 32); ?>" alt="" />
    <span class="author"><?php comment_author_link() ?></span><br /><span class="time"><?php comment_time() ?></span> on <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?></a> <?php edit_comment_link('edit','&nbsp;&nbsp;',''); ?>
    </cite>
    <div class="commenttext"><?php comment_text() ?></div>
    <?php if ($comment->comment_approved == '0') : ?>
    <em>Your comment is awaiting moderation.</em>
    <?php endif; ?>
    </li>
    <?php
    /* Changes every other comment to a different class */
    $oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
    ?>
    <?php endforeach; /* end for each comment */ ?>
    </ol>
    

    Aside from a few images, the rest of the styling is accomplished with CSS:

    ol.commentlist {
    	margin:0;
    	padding:0;
    	}
    
    .commentlist li {
    	list-style:none;
    	margin-bottom:14px;
    	}
    
    .commentlist cite {
    	padding: 7px;
    	display:block;
    	font-style:normal;
    	background:url(http://www.yoursite.com/images/bg_comments2_cite.gif);
    	border-top:1px solid #d6e4c1;
    	border-bottom:1px solid #779d42;
    	color:#596e3b;
    	}	
    
    .commentlist a:link, .commentlist a:visited {
    	color:#596e3b;
    	}
    
    .commentlist a:hover, .commentlist a:active {
    	color:#8ec343;
    	}
    
    .commentlist cite img {
    	padding:1px;
    	border:1px solid #aab59a;
    	float:left;
    	margin-right:9px;
    	}
    
    .commentlist .author {
    	font: small-caps bold 1.2em Georgia, "Times New Roman", Times, serif;
    	text-decoration:underline;
    	}
    
    .commentlist .time {
    	background: url(http://www.yoursite.com/images/bg_clock.gif) no-repeat 1px;
    	padding-left:13px;
    	}
    
    .commenttext {
    	background: #9bc561 url(http://www.yoursite.com/images/bg_comments2_text.jpg) repeat-x bottom;
    	border-top:1px solid #c5f386;
    	padding: 0 20px 10px 20px;
    	color:#fafcf6;
    	}
    

    Keep in mind, each of these examples uses ems for font sizing, so your existing CSS may need to be tinkered with to match the screenshot above.

    Download

  2. The Speech Bubble

    I designed this comment style for my company’s website. It requires two images, the quote marks and the little curl. The relevant template code looks like this:

    <ol class="commentlist">
    <?php foreach ($comments as $comment) : ?>
    <li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
    <div class="quote"><?php comment_text() ?></div>
    <?php if ($comment->comment_approved == '0') : ?>
    <em>Your comment is awaiting moderation.</em>
    <?php endif; ?>
    </li>
    <cite><?php comment_author_link() ?> on <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?> <?php edit_comment_link('edit','&nbsp;&nbsp;',''); ?></a></cite>
    <?php
    /* Changes every other comment to a different class */
    $oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
    ?>
    <?php endforeach; /* end for each comment */ ?>
    </ol>
    

    And here is the CSS:

    .commentlist .quote {
    	background:url(http://www.yoursite.com/images/bg_quote.gif) no-repeat top right;
    	}
    
    .commentlist li {
     	padding: 5px 18px 22px 18px;
    	margin-top:15px;
    	background:#454545 url(http://www.yoursite.com/images/bg_commentlist.gif) bottom no-repeat;
    	color:#e4edee;
    	}
    
    .commentlist cite {
    	display:block;
    	font-style:normal
    	}
    
    .commentlist cite a:link, .commentlist cite a:visited {
    	color:#88e5f0;
    	text-decoration:none;
    	}
    
    .commentlist cite a:hover, .commentlist cite a:active {
    	color:#FFF;
    	text-decoration:underline;
    	}
    

    Download

  3. Alternating Arrows

    This comment styling originated from a music magazine I mocked up but never quite launched (so feel free to use it). I don’t always make use of the “.alt” class for comments, but it’s handy here for making the arrow and colors alternate. The images used are two different “paint” effects, the diagonal pattern, the chainlink and two kinds of arrows.

    Here is the template code:

    <ol class="commentlist">
    <?php foreach ($comments as $comment) : ?>
    <li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
    <div class="commenttext">
    <cite><?php comment_author_link() ?></cite>
    <?php comment_text() ?>
    <span class="date"><img src="/images/commentlink.gif" alt="" /> <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_time() ?> on <?php comment_date('n/j/y') ?></a></span> <?php edit_comment_link('edit','&nbsp;&nbsp;',''); ?>
    </div>
    <?php if ($comment->comment_approved == '0') : ?>
    <em>Your comment is awaiting moderation.</em>
    <?php endif; ?>
    </li>
    <?php
    /* Changes every other comment to a different class */
    $oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';?>
    <?php endforeach; /* end for each comment */ ?>
    </ol>
    

    And here is the CSS:

    ol.commentlist {
    	margin:0;
    	padding:0;
    	}
    
    .commentlist li {
    	margin-bottom:8px;
    	background: #60360b url(http://www.yoursite.com/images/comment_arrows.gif) bottom no-repeat;
    	color:#FFF;
    	list-style:none;
    	width:413px;
    	}
    
    .commentlist .commenttext {
    	background:url(http://www.yoursite.com/images/bg_paint.gif) no-repeat;
    	padding:22px 22px 50px 22px;
    	}
    
    .commentlist cite {
    	display:block;
    	color:#FFF;
    	font-weight:bold;
    	text-transform:uppercase;
    	font-style:normal;
    	background:url(http://www.yoursite.com/images/bg_cite_arrows.gif) bottom repeat-x;
    	padding-bottom:12px;
    	font-size:1.1em;
    	}
    
    .commentlist a:link, .commentlist a:visited {
    	color:#fff9b9;
    	}
    
    .commentlist a:hover, .commentlist a:active {
    	color:#FFF;
    	}
    
    .commentlist .date {
    	background:#930e27;
    	padding:3px;
    	}
    
    li.alt {
    	background:#836241 url(http://www.yoursite.com/images/comment_arrows_alt.gif) no-repeat bottom;
    	}
    
    li.alt .commenttext {
    	background:url(http://www.yoursite.com/images/bg_paint_alt.gif) no-repeat;
    	}	
    
    li.alt .date {
    	background:#67421c;
    	padding:3px;
    	}
    

    Download

198 Responses {+}

Trackbacks

  1. 3 habillages pour les commentaires de votre blog à télécharger
  2. Rapidinhas 06-09-2007 | BrPoint
  3. Mastering Your WordPress Theme Hacks and Techniques
  4. Schweizer Wordpress Magazin » Tipp des Tages » Kommentare verschönern
  5. paidnetpedia.com
  6. SEO & Web Design » Blog Archive » Mastering Your WordPress Theme Hacks and Techniques
  7. SEO & Web Design » Blog Archive » Mastering Your WordPress Theme Hacks and Techniques
  8. Wordpress Comment Styling Round Up
  9. ArsGeek » Wordpress Comment Styling Round Up
  10. Modifiez le style de vos commentaires - blogbrothers - blogbrothers
  11. WordPress Comment Styling | Webmaster-Source
  12. Dar estilo a tus Comentarios Wordpress « Xyberneticos
  13. Personalizar los estilos a tus Comentarios en Wordpress — Simplemente… Nebel
  14. Dar estilo a tus Comentarios Wordpress | Web Grafi 2.0
  15. Bağlantılar #14 Temmuz 2008 | Sinerjik Günlük
  16.   Table Of Contents Of Wordpress Tutorials, Helps, Tips and Tricks by aComment.net
  17. Brève Wordpress Spécial Vacances, 30+ liens utiles et indispensables !
  18. Quick Tips For Better WordPress Comments | Wordprezzie
  19. Dustin Boston » Blog Archive » Link Log for July 26th from 20:32 to 20:32
  20. Wordpress : donnez du style à vos commentaires
  21. 31og (Blog) Day 2008 | Diligent Design
  22. Personalizar comentarios wordpress | Blog Social
  23. 04.10.2008 – Schon gelesen? | QuerBlog
  24. 精通Wordpress系列教程- 1: 精通Wordpress主题Hacks与技巧 | 帕兰映像
  25. links for 2008-10-25 through 2008-10-28 | aloha WEBLOG
  26. EStilos para tus comentarios Wordpress at Blog Borchani Studios
  27. 精通Wordpress系列教程- 1: 精通Wordpress主题Hacks与技巧 - pi4.cn 屁事网
  28. 30 Most Wanted WordPress Comments Page Hacks | instantShift
  29. 30 astuces pour améliorer la présentation des commentaires dans WordPress | Presse-Citron
  30. Complete Wordpress Theme Tutorial « Kolmex
  31. 30?Wordpress ?????????? - ???
  32. 30??????Wordpress?????
  33. 30???Wordpress??????? at ??????
  34. 30???Wordpress??????? - ????_blog
  35. Wordpress plugin and hacks V | Beat Fly Blog
  36. 30??????Wordpress????? - ????
  37. WordPress??? » Blog Archive » ?????Wordpress?????
  38. 30??????Wordpress????? - ????
  39. 250 Wordpress Tutorials
  40. 10 WordPress Tips & Tricks for Your Comment Page | Lists | Tutorial Blog
  41. i P r o n e t S t u d i o » بیش از 50 مرجع برای یادگیری و استفاده بهتر از وردپرس
  42. 10 WordPress Tips & Tricks for Your Comment Page | New Techs
  43. 10 WordPress Tips & Tricks for Your Comment Page | Free Tutorial 4 All
  44. برگزار کننده مسابقات آنلاین بیش از 50 مرجع برای یادگیری و استفاده بهتر از وردپرس | وبلاگ تهران خريد
  45. Link FA | لینک فا » بیش از 50 مرجع برای یادگیری و استفاده بهتر از وردپرس
  46. 70 Very Useful Wordpress Hacks & Tricks » De Web Times - Sharing Useful Resources.
  47. Top 10 Best Wordpress Tweaking Tutorials | Huzzer Magazine
  48. 40+ Awesome Tutorials and Techniques For WordPress Theme Developers | huibit05.com
  49. Anonymous
  50. 250 Wordpress Tutoriels et liens pour tous | Guppytrucs Freeware
  51. US Want - Your Blogs, Social Network, Search Engine for Drivers, UserGuide, Vids, Images, Tutorials
  52. Top 10 Best Wordpress Tweaking Tutorials | Huzzer Magazine
  53. 33 Most Useful Worpdress Comments Page Hacks - Themeflash : One Stop For All Your Web Resources
  54. Debbie’s calm in September, very calm | A Place Of Calm
  55. Blog – Velagapati - 300+ Resources to Help You Become a WordPress Expert
  56. Blog – Velagapati - 300+ Resources to Help You Become a WordPress Expert
  57. Blog – Velagapati - 300+ Resources to Help You Become a WordPress Expert
  58. Styling And Highlighting WordPress Comments | Scrapur.com
  59. Wordpress评论(留言)的30个技巧 | WordPress:最流行的开源博客程序
  60. بیش از 50 مرجع برای یادگیری و استفاده بهتر از وردپرس
  61. WordPress Tutorials and Tips: Part One
  62. The Ultimate Wordpress Developer Toolbox | tripwire magazine
  63. WordPress 300+ Collection of Amazing Resources | Amazing and Inspiring Design
  64. 300+ Resources to Help You Become a WordPress Expert « eBSPAD
  65. 300+ Resources to Help You Become a WordPress Expert | LeVoltz - iPhone Games, Engineering Projects, Wordpress Themes
  66. 100+ Massive Wordpress Tutorial Collection | tripwire magazine
  67. PSD to Wordpress Series Part 3: Final Tutorial | Webdevtuts
  68. Comment Design: Considerations, Best Practices and Examples | Inspiration
  69. Comment Design: Considerations, Best Practices and Examples | Lunch Time Laugh
  70. Comment Design: Considerations, Best Practices and Examples | Mac Bargains
  71. Table Of Contents Of Wordpress Tutorials, Helps, Tips and Tricks | DevWebPro
  72. Comment Design: Considerations, Best Practices and Examples | Fulldigi
  73. Wordpress Tutorial – Πως να φτιάξεις το δικό σου wordpress theme! | inBlog.gr – Webmaster, SEO & Internet Blog
  74. 13 Useful Code Snippets for WordPress Development | Web Design Ledger
  75. (摘)精通Wordpress系列教程一 « 李小西的博客
  76. 14 Tips voor Blog Comment Design
  77. WordPress Theme from Scratch – Day 3: HTML to WordPress | AEXT.NET
  78. 300多种可帮你成为WordPress专家的资源 | 上海网站建设,上海网络公司
  79. wordpress主题的制作和使用技巧 | 一起走过的日子
  80. WordPress Themes — Pearsonified » XMM.IR
  81. 54 Awesome Tutorials To Satisfy The Appetite Of Any Web Developer | Tutorials | PelFusion.com
  82. Wordpress – Recursos para Webmasters | Tienda virtual online. Diseño de paginas web. Posicionamiento Seo y Sem
  83. 65 Of The Best WordPress Tutorials « Junkiee.Net
  84. 9 Wordpress Tricks and Tutorials « Er.Krushna Chandra Muni :: Professional Web Developer | Website Design Orissa | Website Design Bhubaneswar | Website Design India | Website Design New Zealand | Website Design Auckland
  85. 54 Awesome Tutorials for Any Web Developer | The Technology Reports
  86. 13 Useful Code Snippets for WordPress Development | WebsGeek
  87. MimboCake | KiloVox

Leave a Response