• Starryskeyes

    (@starryskeyes)


    Hello,

    I’m using theme Twenty Ten. I have already created the CSS for the styling and it is good. I have seen it done once with styles that were over 3 different types, but can not find that blog again. I am trying to create a loop/array of comment styles.

    Because it is set to odd comments it can only alternate between two. I need to find some other method. Any ideas on how to proceed.

    Here is the current alternating code below.

    —————

    <?php if ($comments) : ?>
    	<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3> 
    
    	<ol class="commentlist">
    
    	<?php foreach ($comments as $comment) : ?>
            <div class="<?=($i%2)?"img2comment":"img1comment";$i++;?>">
    
            <?php
            $isByAuthor = false;
            if($comment->comment_author_email ==
            'email1') {
            $isByAuthor = true;
            }
            ?>
    
            <?php
            $isByauthor2 = false;
            if($comment->comment_author_email ==
            'email2') {
            $isByauthor2 = true;
            }
            ?>

    ————————–
    you can see it here: https://artandillumination.com/2012/black-swamp-arts-festival-gearing-up-for-20th/

    From there I would like to find a way to stop the loop/array if made by specific author.

    Thanks for your help!!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Starryskeyes

    (@starryskeyes)

    I was thinking something along these lines:

    <?php
      $i = 0; ?>
      foreach ($comments as $comment) :
      $i++;
    ?>
    <li id="comment-<?php comment_ID() ?>"
      <?php switch ($i % 6) {
        case 0:
            echo 'class="image1comment"';
            break;
        case 1:
            echo 'class="image2comment"';
            break;
        case 2:
            echo 'class="image3comment"';
            break;
      }
      ?>

    It’s not working though and I’m not sure what I am missing.

    Michael

    (@alchymyth)

    try to use 3 in this line:

    <?php switch ($i % 3) {

    It’s not working though

    what is the result?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Comment Styling with 3 or more styles (using array)?’ is closed to new replies.