• Resolved Vendetta

    (@vendetta)


    When I respond to comments in my comments section, I would like my comments to look different from a visitor’s. On johnaugust.com, his comments are differentiated by a graphic of quotes. How can I do something similar?

Viewing 6 replies - 1 through 6 (of 6 total)
  • I use this sort of thing:
    It all goes below
    <?php foreach ($comments as $comment) : ?>

    In comments.php I have
    <?php
    $isByAuthor = false;
    if($comment->comment_author_email == 'podz@mail.com') {
    $isByAuthor = true;
    }
    ?>

    further down I have
    <?php if($isByAuthor ) { echo '<div class="authorcomment">';} ?>
    <?php comment_text() ?>
    <?php if($isByAuthor ) { echo '</div>';} ?>

    and the css
    .authorcomment {background:#eceef3}

    so you could do the same but use an image for the background…

    nice! Is it possible to do the differentiation by author ID? for example i would like to have that for all user in my staff

    Sure. I’m not sure the syntax for the OR operator in PHP, but you could always do something like he said above with multiple statements:
    if($comment->comment_author_email == 'email2@mail.com') {
    $isByAuthor = true;
    }
    if($comment->comment_author_email == 'email2@mail.com') {
    $isByAuthor = true;
    }

    Good luck!

    nice thank you 🙂
    will try that today

    I’d just like to say that I was looking for this exact feature this evening, and stumbled upon this thread… tried it out, and it works perfectly. I altered it a bit so that instead of a different BG color (as I use alternating BG colors in comments via lists), a yellow star will be placed in front of any comments I make.
    Anyway, it works perfectly – thank you very much! 🙂

    Hmm.. podz.. I’ve tried your method several several times and it just doesn’t seem to work at all, I always get this error when I put all that in my comments.php:

    Parse error: syntax error, unexpected ‘@’ in /home/.deb/spiritusanti/sacred-nights.com/wp-content/themes/fashioninfinite/comments.php on line 18

    Any idea what this might be?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Posting comments as admin that reflects admin’ is closed to new replies.