• Resolved opossum123

    (@opossum123)


    I’d like to have my own comments appear differently to the ones my site visitors submit. How am I accomplishing this so that, once I login and comment on my own blog, visitors can easily distinguish this comment from all the others?

    Any specific help is much appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • There are a number of plugins for this:

    https://codex.www.ads-software.com/Plugins/Comments

    But basically, you can differentiate your comments by testing on your user ID, which, when logged in, is saved with each comment. This will be available through:

    $comment->user_id

    So if you are using your admin account (user ID 1) to post comments and you just wanted an image to appear, you could do something like the following in the comments loop of your comments template:

    <?php if( 1 == $comment->user_id ) : ?>
    <img src="/path/to/my/image.jpg" />
    <?php endif; ?>

    Thread Starter opossum123

    (@opossum123)

    Thanks for your help. I found one plugin that would be perfect — “CustomComments” — but I couldn’t get it to work as it always resulted in a system error (same with some other users as reported on their blog).

    It would, actually, be perfect if it would work since it assigns CSS classes to comments; one class identifying the blog admin, another one for all others. That way, I could assign a background image (aligning to the top right) or color to the blog owner’s comments. Nice.

    But again, unfortunately, it doesn’t work.

    Would the description you provided do the same? If so, how and where do I put that into? (I’m a total PHP newbie.)

    Or do you know of another plugin that would do the aforementioned (just without a system error ;-)?

    WordPress user Jalenack points to how to use the mechanism I point out above to set a CSS class based on user ID:

    https://codex.www.ads-software.com/User:Jalenack/Comment_Loop_Beauty

    It’s a pretty common method.

    Thread Starter opossum123

    (@opossum123)

    Sorry, Kafkaesqui, for my late reply. I got it solved after all. Though I had to modify the method shown in the above link slightly.

    Instead of putting the code into the <cite> tag I had to put it into the < li> tag just above. Otherwise, only the author’s link would change the appearance.

    Again, thanks a million, Kafkaesqui!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Comment image for blog owner?’ is closed to new replies.