• I’m trying to tweak the code in my theme which handles comments. This is on a 2.9.1-updated site.

    I am using an old pre-2.7 loop, with a foreach statement rather than the new wp_list_comments call, because I customize the way comments appear (alternating colors in backgrounds), so I can’t use the “ul” output of the new way, need the old “li” type of output (single list items, rather than the whole list at once).

    Anyway, what I need is a way to write an “if” statement that will weed out pingbacks and trackbacks, but haven’t been able to get it to work, so I thought I’d ask you guys.

    Here’s the basic loop:

    ====================
    <?php foreach ($comments as $comment) : ?>
    
    <?php if ... [this is the one I need help with]
    
    	<li>
    	<?php if ($comment->comment_approved == '0') : ?>
    		<em>Comment is awaiting moderation.  Forgive us for the delay.</em>
    	<?php else : ?>
    		<?php comment_text() ?>
    	<?php endif; ?>
    	</li>
    <?php endif; ?>
    <?php endforeach; ?>
    
    ====================

    I’ve been trying to figure out a way to get it to check “comment_type” for the text “Comment” but so far it seems to be beyond my abilities to tinker with the code. Or is there a better way to do it than using an “if” statement?

    Anyone? Please?

    Thanks in advance…

The topic ‘Need help with “if” statement and comment_type’ is closed to new replies.