• Resolved outravedlace

    (@outravedlace)


    Hi Im trying to change the appearance of the administrator’s comment so it can stand out from the other comments. How do I do this?
    Thank you ahead of time!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Do you mean author, or admin?

    Author as in, the author of a post…. or the main admin account?

    A well written theme will already be using the necessary CSS classes, so it’s a matter of writing it into the stylesheet.

    A link to your website would be most helpful. ??

    Thread Starter outravedlace

    (@outravedlace)

    Yes the author and yes I have a stylesheet and the link to my site is https://www.outraved.com thanks ??

    Does your theme have a comments.php?

    Could you please post the code from the file inside backticks or use a pastebin and post the link..
    https://wordpress.pastebin.com/

    Thread Starter outravedlace

    (@outravedlace)

    yes…bout to post

    Thread Starter outravedlace

    (@outravedlace)

    Backup the comments file, then find this…

    <ol class="commentlist">
    <?php foreach ($comments as $comment) : ?>
    
    	<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
    
    <div class="commentmetadata">
    <strong><?php comment_author_link() ?></strong>, <?php _e('on'); ?> <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> <?php _e('at');?> <?php comment_time() ?></a> <?php _e('Said:'); ?> <?php edit_comment_link('Edit Comment','',''); ?>
     		<?php if ($comment->comment_approved == '0') : ?>
    		<em><?php _e('Your comment is awaiting moderation.'); ?></em>
     		<?php endif; ?>
    </div>
    
    <?php comment_text() ?>
    	</li>
    
    <?php /* Changes every other comment to a different class */
    	if ('alt' == $oddcomment) $oddcomment = '';
    	else $oddcomment = 'alt';
    ?>
    
    <?php endforeach; /* end for each comment */ ?>
    	</ol>

    And replace that with…

    <ol class="commentlist">
    	<?php wp_list_comments(); ?>
    	</ol>

    See how that works first, then we can work on the CSS…

    Thread Starter outravedlace

    (@outravedlace)

    didnt work i got

    Fatal error: Call to undefined function wp_list_comments() on line 24

    Sorry that’s my fault i assumed you were on 2.7 …

    Considered upgrading?

    You can get the post author id using..

    $post->post_author

    This would give you the ID of the author, if you can find a comment_author_id type function to compare that with then it’s possible..

    Thread Starter outravedlace

    (@outravedlace)

    hmmm maybe i should upgrade real quick then do what u said about replacing the file…this seems so complicated ??

    Just follow the instructions to the letter, and it’s easy as pie…

    https://codex.www.ads-software.com/Upgrading_WordPress

    If you have any special plugins enabled, i’d suggest as a general rule to disable them while upgrading…

    Thread Starter outravedlace

    (@outravedlace)

    Thank you alot for your help Ive decided to just use gravatars to distinguish each other. I still need to upgrade my wordpress also so I will use your advice…thank you!!! ??

    Can you apply a class to the comment if the comment author has a particular role in the site (e.g. Editor)? At the moment I have one users details hardwired in the comments.php code so if the comment is from them a class of admin is added. but it would be great to have a group of people – even better if it were against a user id, rather than a hackable name and email!

    Here’s the relevant bit from what I’m using at the moment:

    <?php $author = array(
                "highlight" => "admin",
                "email" => "[email protected]",
                "name" => "Webmaster"
        );  
    
    <li id="comment-<?php comment_ID(); ?>" class="<?php
            /* Highlighting class for author or regular striping class for others */
            /* Get current author name/e-mail */
            $this_name = $comment->comment_author;
            $this_email = $comment->comment_author_email; 
    
            /* Compare to $author array values */
            if (strcasecmp($this_name, $author["name"])==0 && strcasecmp($this_email, $author["email"])==0)
                _e($author["highlight"]);
            else
                _e($thiscomment);  
    
            ?>"> 
    
    ?>

    Any help would be greatly appreciated!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How Do I Change the Appearance of the Administrators Comment?’ is closed to new replies.