Title: &#8216;Alt&#8217; styled comments
Last modified: August 19, 2016

---

# ‘Alt’ styled comments

 *  Resolved [jaabi](https://wordpress.org/support/users/jaabi/)
 * (@jaabi)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/alt-styled-comments/)
 * I’ve recently converted my comments style from WordPress 2.6 to 2.7 formatting
   by moving the comment layout to the functions.php file as mentioned [http://codex.wordpress.org/Template_Tags/wp_list_comments](http://codex.wordpress.org/Template_Tags/wp_list_comments)
   here.
    The reason for this is simple, I wanted to split my comments into pages.
   However while doing this allowed this to work, my comments stopped using their“
   alt” styles (flipping alignment of text and avatar), which I learnt from following
   this page. [http://www.darrenhoyt.com/2007/08/18/styling-your-wordpress-comments/](http://www.darrenhoyt.com/2007/08/18/styling-your-wordpress-comments/)
 * At first I discovered the lines
 *     ```
       <?php foreach ($comments as $comment) : ?>
       ```
   
 * and
 *     ```
       $oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';?>
       <?php endforeach; /* end for each comment */ ?>
       ```
   
 * would either cause comments not to show up at all, or would just produce a blank
   screen. (Why isn’t PHP telling me the error?)
    Reading around it seems that “
   alt” is now built into the comments. But yet, my comments do not alternate no
   matter what I try.
 * This is what is in the functions.php file:
 *     ```
       function mytheme_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
       <li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
       <div id="commentavatar"><?php echo get_avatar( $comment, 64 ); ?></div>
       <cite></cite>
       <div class="commentbg">
       <div id="actualtext">
       <h3><?php comment_author_link() ?></h3>
       <?php comment_text() ?>
       <span class="date"><img src="<?php echo get_option('siteurl'); ?>/../layout/comment_time.png" alt="" /> <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_time() ?> on <?php comment_date('F jS, Y') ?></a></span> <?php edit_comment_link('edit','&nbsp;&nbsp;',''); ?>
       </div></div>
       <?php if ($comment->comment_approved == '0') : ?>
       <em>Your comment is awaiting moderation.</em>
       <?php endif; ?>
       <?php }?>>
       ```
   
 * Called via wp_list_comments in the comments.php
 * What do I have to do to get the .alt style value to be used in ‘odd’ comments
   again?
 * EDIT: One more thing, though I am unsure this is possible. Does WP record if 
   a post was made by an unregistered guest? The Admin panel doesn’t seem to differentiate
   comments any more than just by the name of the poster.
    I was wondering (after
   the above is sorted) if I can make it so all guest posts get labeled as written
   by a guest rather than what the guest writes as their name, but I can still see
   that name in the admin panel.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/alt-styled-comments/#post-1067115)
 * The comments are given class of ‘even’ and ‘odd’ alternately, so it might just
   be easier to use these built-in classes for your alternate CSS.
 * ol.commentlist li.even {…}
    ol.commentlist li.odd {…}
 *  Thread Starter [jaabi](https://wordpress.org/support/users/jaabi/)
 * (@jaabi)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/alt-styled-comments/#post-1067148)
 * I thought of that lying in the dark last night, and was all “oh man I’m stupid”.
 * However that made no difference. _Huh?_
 *     ```
       #commentavatar img {
       	position: absolute;
       	margin: 16px;
       	padding: 0px;
       	margin-right: auto;
       	background: #FF0000;
       	z-index: 70;
       }
   
       ol.commentlist {
       	margin:0;
       	padding:0;
       	margin-top: 28px;
       }
   
       #actualtext {
       	position: relative;
       	margin-top: -78px;
       	margin-left: 116px;
       	margin-right: 24px;
       	z-index: 70;
       }
   
       .commentlist cite {
       	background: url("/layout/comment_bg1-1.png") no-repeat;
       	height: 100px;
       	position: relative;
       	display:block;
       	font-size:1.1em;
       	z-index: 40;
       }
   
       .commentlist .commentbg {
       	float: right;
       	width: 500px;
       	padding:0;
       	margin-top: 0px;
       	margin-left: auto;
       	margin-bottom: 14px;
       	padding-bottom: 2px;
       	background: url("/layout/comment_bg1-2.png");
       	z-index: 30;
       }
   
       .commentlist li {
       	margin-bottom:8px;
       	margin-left:auto;
       	margin-right:auto;
       	background: url("/layout/comment_bg1-3.png") bottom no-repeat;
       	list-style:none;
       	width:500px;
       	overflow-x: hidden;
       	position: relative;
       	z-index: 40;
       }
       li.odd cite {
       	background: url("/layout/comment_bg2-1.png") no-repeat;
       }
   
       li.odd .commentbg {
       	background: url("/layout/comment_bg2-2.png");
       }	
   
       ol.commentlist li.odd {
       	background: url("/layout/comment_bg2-3.png") bottom no-repeat;
       }
   
       li.odd #actualtext {
       	margin-left: 24px;
       	margin-right: 116px;
       }
   
       li.odd #commentavatar img {
       	margin-left: 424px;
       }
       ```
   
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/alt-styled-comments/#post-1067172)
 * I’d really need to see a page of comments on your site.
 *  Thread Starter [jaabi](https://wordpress.org/support/users/jaabi/)
 * (@jaabi)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/alt-styled-comments/#post-1067186)
 * I can’t provide a direct link because I’m trying to get everything done (or rather
   a much bigger portion of material than the current design) before uploading it
   all.
 * Here is a screenshot of before I allowed for paging.
    [http://img16.imageshack.us/img16/3632/commentstyle.png](http://img16.imageshack.us/img16/3632/commentstyle.png)
   Now, only the top style appears.
 * Alternatively here is a zip file containing most of what I think drives my layout.
   
   [http://jirby.cleverpun.com/webdesign-testing/TOSfiles.zip](http://jirby.cleverpun.com/webdesign-testing/TOSfiles.zip)
 * Note I am using a /category/postname/ permalink format, and the “blog” root is
   set to go to the site root rather than /updcmc/
 * Apologies if this is a problem this way.
 *  Thread Starter [jaabi](https://wordpress.org/support/users/jaabi/)
 * (@jaabi)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/alt-styled-comments/#post-1067187)
 * blargh double post *nukes*
 *  Thread Starter [jaabi](https://wordpress.org/support/users/jaabi/)
 * (@jaabi)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/alt-styled-comments/#post-1067204)
 * Aha. I discovered my problem when looking at another custom theme.
 * I did not have
 *     ```
       <?php comment_class(); ?>
       ```
   
 * in my li tag in the comment code in functions.php. I did find it odd that no 
   class (most of my styles are id based) was being applied to any comment.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘‘Alt’ styled comments’ is closed to new replies.

## Tags

 * [alt](https://wordpress.org/support/topic-tag/alt/)
 * [odd](https://wordpress.org/support/topic-tag/odd/)

 * 6 replies
 * 2 participants
 * Last reply from: [jaabi](https://wordpress.org/support/users/jaabi/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/alt-styled-comments/#post-1067204)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
