April 12, 2006
5:42 pm | Last updated: April 12, 2006 at: 5:53 pm

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.

[code]< ?php if ($comments) : ?>

Trackbacks/Pings

    < ?php foreach ($comments as $comment) : ?>
    < ?php if (get_comment_type() !="" "comment"){ ?>

  1. < ?php comment_date('f js, y') ?> at < ?php comment_time() ?> < ?php edit_comment_link('e','',''); ?>

  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_date('f js, y') ?> at < ?php comment_time() ?> < ?php edit_comment_link('e','',''); ?>

    < ?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 */ ?>[/code]
    [Source: cre8d-design.com]

Related Posts:

No followup yet

Leave a Response

Comment Preview

« Reflections from a blog designerWhat is Web 2.0? »

Feed Icon