diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)

Apr122006

Separating Pingbacks/Trackbacks from comments in WordPress 2.0

Here’s some code below to enable you to separate pingbacks/trackbacks from comments in WordPress 2.0. Pingbacks/trackbacks are listed first, followed by comments in this example. It will also not show the excerpt for pingbacks/trackbacks and just show the link for these.

The basic idea is to loop through your comments twice – once displaying the pingbacks/trackbacks and once displaying the comments.

Copy and paste this code into your comments template – you’ll need to remove the old display of comments first.

< ?php if ($comments) : ?>

Trackbacks/Pings

    < ?php foreach ($comments as $comment) : ?> < ?php if (get_comment_type() !="" "comment"){ ?>
  1. < ?php comment_author_link() ?> < ?php if ($comment->comment_approved == '0') : ?> Your comment is awaiting moderation. < ?php endif; ?>
  2. < ?php /* changes every other comment to a different class */if ('alt' ="=" $oddcomment) $oddcomment ="" ''; else $oddcomment ="" 'alt'; ?> < ?php } ?> < ?php endforeach; /* end for each comment */ ?>

    Comments

    < ?php foreach ($comments as $comment) : ?> < ?php if (get_comment_type() ="=" "comment"){ ?>
  3. < ?php comment_author_link() ?> < ?php if ($comment->comment_approved == '0') : ?> Your comment is awaiting moderation. < ?php endif; ?> < ?php comment_text() ?> < ?php /* changes every other comment to a different class */if ('alt' ="=" $oddcomment) $oddcomment ="" ''; else $oddcomment ="" 'alt'; ?> < ?php } ?> < ?php endforeach; /* end for each comment */ ?>
[Source: cre8d-design.com]
Share This Story, Choose Your Platform!