WordPress.org

Ready to get started?Download WordPress

Forums

Alternating Color for Comments (3 posts)

  1. sherrikicksrocks
    Member
    Posted 4 years ago #

    I could use some help. I would like to use alternate colors on my comments. I've searched online and on the forums, have tried different things that I've come across to no avail. If anyone could take a look at the Comments.php for my theme and guide me where to make changes, as well as what I would need to add to my style.css, I'd be very grateful.
    [The theme I'm using might be an older one, so I don't know if that has anything to do with this.]

    This is the Comments.php for the theme I'm using in its original form:

    <?php if ( !empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
    <p>This page is password protected. Enter your password to continue!</p>
    <?php return; endif; ?>
    
    <?php if ( $comments ) : ?>
    
    <h1>Comments</h1>
    
    <?php foreach ($comments as $comment) : ?>
    
    <div class="comment">
    <div class="gravatarside"><?php if (function_exists('get_avatar')) { echo get_avatar($comment,$size='48'); } ?></div>
    <p class="commenticon">
    <?php comment_type('Comment','Trackback','Pingback'); ?> from <?php if ('' != get_comment_author_url()) { ?><a href="<?php comment_author_url(); ?>"><?php comment_author() ?></a><?php } else { comment_author(); } ?>
    <?php edit_comment_link('[edit]',' | '); ?><br />
    <?php comment_date() ?> at <?php comment_time(); ?></p>
    <?php comment_text() ?>
    <h1><font color="#FFFFFF">xxx</font></h1>
    <?php if ($comment->comment_approved == '0') : ?>
    <p>Thank you for your comment! It has been added to the moderation queue and will be published here if approved by the webmaster.</p>
    <?php endif; ?>
    </div>
    
    <?php endforeach; ?>
    <?php endif; ?>
    
    <?php if ($post->comment_status == "open") : ?>
    <div id="respond">
    <br /><br /><br /><h1>Write a comment</h1>
    <?php if (get_option('comment_registration') && !$user_ID) : ?>
    <p>You need to <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">login</a> to post comments!</p>
    </div>
    
    <?php else : ?>
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    <?php if ($user_ID) : ?>
    <p class="loggedin">You are logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out">Log out</a>.</p>
    
    <?php else : ?>
    <p><label for="author">Name:</label><br />
    <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" tabindex="1" /></p>
    <p><label for="email">E-mail:</label><br />
    <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2" /></p>
    <p><label for="url">URL:</label><br />
    <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" tabindex="3" /></p>
    
    <?php endif; ?>
    <p><label for="comment">Message:</label><br />
    <textarea name="comment" id="comment" cols="45" rows="4" tabindex="4"></textarea></p>
    <p><input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    <input type="submit" name="submit" value="Submit!" class="button" tabindex="5" /></p>
    <p><?php do_action('comment_form', $post->ID); ?></p>
    </form>
    </div>
    
    <?php endif; ?>
    <?php endif; ?>
  2. levani01
    Member
    Posted 4 years ago #

  3. baal666
    Member
    Posted 3 years ago #

    Very old stuff levani01... does not work anymore.

Topic Closed

This topic has been closed to new replies.

About this Topic