• For the Blix theme, how do I change the look of the comments for admin only?

    In simple terms, when I make a comment on my own weblog, the comment is displayed exactly the same as the others. I want to show a difference in looks. I want to add a background colour and change the header of the comment to a different colour.

    Anyone know how to do this or what part of the coding I will need to play with?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You need a plugin like this one:
    https://dev.wp-plugins.org/wiki/AuthorHighlight

    & then you need to give it your details & alter the CSS accordingly.

    Thread Starter 350z

    (@350z)

    Isn’t there a way where you can just edit the coding in the comments file/page?

    Yup.

    Open your comments template.
    Look for this line:
    <?php foreach ($comments as $comment) : ?>

    Right underneath that, paste this, but use your email address:

    <?php
    $isByAuthor = false;
    if($comment->comment_author_email == '[email protected]') {
    $isByAuthor = true;
    }
    ?>

    then… put this around the comment text statement:
    <?php if($isByAuthor ) { echo '<div class="authorcomment">';} ?><?php comment_text() ?><?php if($isByAuthor ) { echo '</div>';} ?>

    So look for <?php comment_text() ?> and place the other code around it.

    Then in your css:
    .authorcomment {padding:5px;background-color: #D8CACA;}

    Thread Starter 350z

    (@350z)

    Thanks, it works, but there’s a slight problem.

    For some reaosn, the comment appears twice in the same comment. (If that makes sense.) Like the first comment shows like the others, and underneath it it shows it again but this time with the ‘authorcomment’ style, but all in one comment.

    How do I fix this?

    Thread Starter 350z

    (@350z)

    I found out what was wrong. I had the ‘comment_text’ line twice.

    One other quick question, how would I change the header colour of the author comment?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change Looks of Admin Comment’ is closed to new replies.