Ready to get started?Download WordPress


Comment User and message color change (1 post)

  1. cobusbo
    Posted 11 months ago #

    Hi Im trying to change the color of the names of certain users who post comments on my blog but im not sure what to edit. Ive been trying to edit the function_comment.php file since I saw the color codes there makes impact on all the people names and messages. But I want only to specify a different default color for each user or a specified user role...

    I know it has something to do with the following line, but im not sure where to start...

    <<?php echo $tag ?> <?php comment_class(empty($args['has_children']) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
        <?php if ('div' != $args['style']) : ?>
            <div id="div-comment-<?php comment_ID() ?>" class="comment-body">
            <?php endif; ?> 
            <?php //if ($args['avatar_size'] != 0) echo get_avatar($comment, $args['avatar_size']); ?>
            <?php echo '<span style="color:#63B8FF;">'. preg_replace("/[^A-Za-z0-9 ]/", '', urldecode(get_comment_author())).'</span><br/>'; ?> 
            <?php if ($comment->comment_approved == '0') : ?>
                <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
            echo $comment->comment_content; 
            $now = new DateTime(date_i18n('Y-m-d H:i', time()));
            $ref = new DateTime(get_comment_date('Y-m-d') . ' ' . get_comment_time('H:i'));
            $diff = $now->diff($ref);
            echo ' <span style="color:#CCCCCC;"><i>(';
            if ($diff->d) {
                printf('%dd', $diff->d);
            } else {
                if ($diff->h) {
                    printf('%dh', $diff->h);
                } else {
                    printf('%dm', $diff->i);
             echo ' ago)</i></span>';
             // edit_comment_link(__('(Edit)'), '  ', '');



You must log in to post.

About this Plugin

About this Topic