WordPress.org

Forums

highlighting admin comments (12 posts)

  1. maestro42
    Member
    Posted 8 years ago #

    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!

  2. maestro42
    Member
    Posted 8 years ago #

    anyone have any ideas ?

  3. maestro42
    Member
    Posted 8 years ago #

    no ideas for this problem ?

  4. 4k
    Member
    Posted 8 years ago #

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

    Google can answer many questions.

  5. fr3nzy17
    Member
    Posted 8 years ago #

    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/

  6. Pizdin Dim
    Member
    Posted 8 years ago #

    Author Highlight works well.

  7. Alex Cragg
    Member
    Posted 8 years ago #

    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.

  8. fr3nzy17
    Member
    Posted 8 years ago #

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

  9. Alex Cragg
    Member
    Posted 8 years ago #

    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?

  10. Alex Cragg
    Member
    Posted 8 years ago #

    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 */ ?>
  11. fr3nzy17
    Member
    Posted 8 years ago #

    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?

  12. Alex Cragg
    Member
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags