• Resolved ladycrow

    (@ladycrow)


    Maybe I’m just missing it. I’d like to style my comments so that alternating comments area unique style.

    I found a suggestion to do it via the “$oddcomment” method but that’s not working. This suggestion was using 2.3 so perhaps something has changed since then.

    What code would I need to add/alter to achieve this? Just the PHP, the CSS isn’t my issue.

    Thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Ladycrow,

    It’s usually not too hard and the $oddcomment method should work fine. Once you can give the comment it’s own class, then it’s just CSS.

    Which theme are you using?

    Thread Starter ladycrow

    (@ladycrow)

    I am using NeoSapien. It seemed to be -slightly- outdated and I’ve tweaked it a bit. It didn’t have the $oddcomment so I added what I found.. resulting in this

    <?php foreach ($comments as $comment) : ?>
    
    <li class="<?php echo $oddcomment; ?> " id="comment-<?php comment_ID() ?>">
     <?php
       echo get_avatar( get_comment_author_email(), $size = '50', $default = 'https://www.ofsexandlove.com/wp/wp-content/themes/ofsexandlove/images/avatar.jpg' );
       ?>
    
    	<cite><?php comment_type(__('Comment'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> on <?php comment_date() ?> <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite>
    	<?php comment_text() ?>
    	</li>
    <?php /* Changes every other comment to a different class */
        if("altcomment" == $oddcomment) {$oddcomment="";}
        else { $oddcomment="altcomment"; }
    ?>
    <?php endforeach; ?>
    Thread Starter ladycrow

    (@ladycrow)

    Just wondering if anyone else has any thoughts on this one..?

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Sorry, with the profile link not working I could not find this link.

    I’ll take a look at this when I get home tonight from work, this is pretty easy to do.

    Thread Starter ladycrow

    (@ladycrow)

    No problem. Thanks a lot!

    It seems my comments file is pretty outdated so I’m going to see if I can swap it with the default theme comments.php and if that’ll help any

    -edit-
    It did help. I’m not even sure how but it’s working so I’ll close this (if I can)

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Well, that was easy! Good luck with your CSS now ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Comments Styling’ is closed to new replies.