• Hello,

    Thank you for reading and trying to help solve this.

    I have some images that I have used to show up for specific authors of comments, including myself. It all works fine.

    I also have images that I want to rotate as comments are added. This also works fine.

    My problem is how to work it out so that the rotating images does not go into effect for the ones I have specified for specific authors. I am not sure how to tell it when not to alternate.

    Here is the php for these:

    Author specific:

    <?php
            $isByAuthor = false;
            if($comment->comment_author_email ==
            '[email protected]') {
            $isByAuthor = true;
            }
            ?>

    then:

    <?php if($isByAuthor ) { echo '<div class="authorcomment">';} ?>
                            <?php if($isByIamys ) { echo '<div class="othercomment">';} ?>
                            <?php comment_text() ?>
    		 	<?php if($isByAuthor ) { echo '</div>';} ?>
                            <?php if($isByother ) { echo '</div>';} ?>

    and for the alternating one:(as I have now so it’s disabled)

    <?php /* Changes every other comment to a different class */
    		if ('alt' == $oddcomment) $oddcomment = '';
    		else $oddcomment = 'alt';
    	?>

    [please remember to mark any posted code – https://codex.www.ads-software.com/Forum_Welcome#Posting_Code ]

Viewing 1 replies (of 1 total)
  • Thread Starter Starryskeyes

    (@starryskeyes)

    Let me try to better information.

    I am using the Black-letterhead Theme.

    I am using the following comments code and would also like to add alternating multiple images for comments other than the comments made by specific authors (which have specifications below):
    ——————————————–

    <?php foreach ($comments as $comment) : ?>
    
            <?php
            $isByAuthor = false;
            if($comment->comment_author_email ==
            '[email protected]') {
            $isByAuthor = true;
            }
            ?>
    
            <?php
            $isByname = false;
            if($comment->comment_author_email ==
            '[email protected]') {
            $isByname = true;
            }
            ?>
    
    		<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
    			<cite><code><?php comment_author_link() ?></cite> says:</code>
    			<?php if ($comment->comment_approved == '0') : ?>
    			<em>Your comment is awaiting moderation.</em>
    			<?php endif; ?>
    
    			<small class="commentmetadata"><a>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('e','',''); ?></small>
    
                            <?php if($isByAuthor ) { echo '<div class="authorcomment">';} ?>
                            <?php if($isByname ) { echo '<div class="Iamyscomment">';} ?>
                            <?php comment_text() ?>
    		 	<?php if($isByAuthor ) { echo '</div>';} ?>
                            <?php if($isByIamys ) { echo '</div>';} ?>
    
    	<?php endforeach; /* end for each comment */ ?>

    [please remember to mark any posted code – https://codex.www.ads-software.com/Forum_Welcome#Posting_Code – the above code is partly corrupted]

    ——————–
    I set up the CSS like this:
    —————–

    .img1comment{
            margin: 15px 50px 10px 50px;
    	padding: 0px 0px 90px 0px;
            width: 550px
    	text-align: left;
            background: url(https://blog/media/image1.png) no-repeat bottom;
            align: center
            }

Viewing 1 replies (of 1 total)
  • The topic ‘Conditional images for comment avatars’ is closed to new replies.