• 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

    (@maestro42)

    anyone have any ideas ?

    Thread Starter maestro42

    (@maestro42)

    no ideas for this problem ?

    using wordpress highlight admin comments on a google search provides this as the third link after your question

    Google can answer many questions.

    fr3nzy17

    (@fr3nzy17)

    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/

    Pizdin Dim

    (@pizdin_dim)

    Author Highlight works well.

    Alex Cragg

    (@epicalex)

    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

    (@fr3nzy17)

    What do you mean by alternate highlighting? The script is pretty workable, what are you trying to do?

    Alex Cragg

    (@epicalex)

    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

    (@epicalex)

    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

    (@fr3nzy17)

    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

    (@epicalex)

    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 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.