Title: highlighting admin comments
Last modified: August 18, 2016

---

# highlighting admin comments

 *  [maestro42](https://wordpress.org/support/users/maestro42/)
 * (@maestro42)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/highlighting-admin-comments/)
 * Is there a way to highlight admin comments?
 * I tried doing an if statement inside the comment loop to see if the comment was
   posted by the admin – and then change the alt variable to give it different css
   for that specific comment so the admin’s comments are highlighted.
 * It wasn’t working for me, does anyone know how to do this? Also is it possible
   to highlight all comments for certain roles? Like all admin’s or all editors,
   etc..
 * thanks!

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

 *  Thread Starter [maestro42](https://wordpress.org/support/users/maestro42/)
 * (@maestro42)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-528870)
 * anyone have any ideas ?
 *  Thread Starter [maestro42](https://wordpress.org/support/users/maestro42/)
 * (@maestro42)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529109)
 * **no ideas for this problem ?**
 *  [4k](https://wordpress.org/support/users/4k/)
 * (@4k)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529111)
 * using wordpress highlight admin comments on a google search [provides this](http://inner.geek.nz/archives/2005/01/12/wp-plugin-official-comments/)
   as the third link after your question
 * Google can answer many questions.
 *  [fr3nzy17](https://wordpress.org/support/users/fr3nzy17/)
 * (@fr3nzy17)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529147)
 * Actually, I’ve tried using almost all the plugins available for this type of 
   effect, and either they don’t work, or are not compatible with certain WP versions.
   Google helps not one bit.
 * My script will hopefully solve your problem: [http://www.sacred-nights.com/2007/04/06/release-of-version-15-of-the-admin-visitor-differentiation-script/](http://www.sacred-nights.com/2007/04/06/release-of-version-15-of-the-admin-visitor-differentiation-script/)
 *  [Pizdin Dim](https://wordpress.org/support/users/pizdin_dim/)
 * (@pizdin_dim)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529148)
 * Author Highlight works well.
 *  [Alex Cragg](https://wordpress.org/support/users/epicalex/)
 * (@epicalex)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529150)
 * fr3nzy17, is there a way to mod your script so that i can still use alternate
   highlighting? ive tried and failed, not just with your code but others. i can
   get one or the other to work, but not both combined.
 *  [fr3nzy17](https://wordpress.org/support/users/fr3nzy17/)
 * (@fr3nzy17)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529151)
 * What do you mean by alternate highlighting? The script is pretty workable, what
   are you trying to do?
 *  [Alex Cragg](https://wordpress.org/support/users/epicalex/)
 * (@epicalex)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529152)
 * i had the highlighting set so that every other comment was either green or orange,
   using $oddcomment, or something like that.
 * I wanted to still have every other comment a different colour, but when i post
   a comment, have that be a different colour too, so the class would be assigned
   as author, or something, and for that comment it would ignore the $oddcomment
   bit…
 * does that make sense?
 *  [Alex Cragg](https://wordpress.org/support/users/epicalex/)
 * (@epicalex)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529153)
 * this is what i have
 *     ```
       <?php foreach ($comments as $comment) : ?>
           <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
             <div class="commentname">
               <?php comment_author_link()?> @ <?php comment_date('F jS, Y') ?>
       		<?php edit_comment_link(__("Edit This"), ''); ?> 
   
             </div>
            	 <?php if ($comment->comment_approved == '0') : ?>
            	 <em>Your comment is awaiting moderation.</em>
             	<?php endif; ?>
       		<div class='commenttext'>
       		<div class="gravatar"><img src="<?php gravatar("PG","32");?>" /></div>
   
       			<div class="commentp"><?php comment_text();?></div>
       		</div>
   
           </li>
           <?php /* Changes every other comment to a different class */
       	if ('alt' == $oddcomment){$oddcomment = 'standard'; } else { $oddcomment = 'alt'; }?>
           <?php endforeach; /* end for each comment */ ?>
       ```
   
 *  [fr3nzy17](https://wordpress.org/support/users/fr3nzy17/)
 * (@fr3nzy17)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529154)
 * Ah I see what you mean. So what happens once you give the admin a CSS class, 
   and still have the alternate highlighting in your comments? Does one overlap 
   the other? And which one?
 *  [Alex Cragg](https://wordpress.org/support/users/epicalex/)
 * (@epicalex)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529161)
 * ok ive sorted it, just came to reply to your post, had one more try and cracked
   it.
 *     ```
       <?php foreach ($comments as $comment) : ?>
       <li class="<?php echo $oddcomment; ?>" id="<?php author_highlight(); ?>">
             <div class="commentname">
               <?php comment_author_link()?> @ <?php comment_date('F jS, Y') ?>
       		<?php edit_comment_link(__("Edit This"), ''); ?> 
   
             </div>
            	 <?php if ($comment->comment_approved == '0') : ?>
            	 <em>Your comment is awaiting moderation.</em>
             	<?php endif; ?>
       		<div class='commenttext'>
       		<div class="gravatar"><img src="<?php gravatar("PG","32");?>" /></div>
   
       <div class="commentp"><?php comment_text();?></div>
       		</div>
   
           </li>
           <?php /* Changes every other comment to a different class */
       if ('alt' == $oddcomment){
       $oddcomment = 'standard';}
       else {$oddcomment = 'alt';} ?>
           <?php endforeach; /* end for each comment */ ?>
       ```
   
 * this is using [author highlight](http://turnipspatch.com) plugin.
 * instead of having the id defined as the comment number of whatever it was, i 
   put the php that created the alternate highlighting as the class, and the author
   highlight as the id. works a charm.

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

The topic ‘highlighting admin comments’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 11 replies
 * 5 participants
 * Last reply from: [Alex Cragg](https://wordpress.org/support/users/epicalex/)
 * Last activity: [19 years, 1 month ago](https://wordpress.org/support/topic/highlighting-admin-comments/#post-529161)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
