Message Box

Tuesday, February 3, 2009

Separate WordPress Comments and Trackbacks












With all the WordPress themes available to WordPress users, it always surprises me how these incredible theme authors don’t take a few extra seconds to separate their theme’s trackbacks from the comments. It doesn’t look very professional and it can make it extremely difficult to follow a conversation in the comments.

Separating your trackbacks and comments requires a minimal amount of coding work to set up. First, you’ll want to make a backup of your comments.php file just in case something goes wrong. Next, follow these three steps:

1 ) Access your comments.php file and locate the following code:

< ?php foreach ($comments as $comment) : ? >

Immediately after the above code, you’ll want to place this code:

< ?php $comment_type = get_comment_type(); ? >
< ?php if($comment_type == 'comment') { ? >

2 ) Next, you’ll want to scroll down a little bit and locate the following code:

< ?php endforeach; /* end for each comment */ ? >

Immediately before the above code, you’ll want to place this code:

< ?php } /* End of is_comment statement */ ? >

This will filter out all of the trackbacks and pingbacks from your main comments loop. Now we need to create a second comments loop to display the trackbacks and pingbacks.

3 ) Almost immediately below the code from step 2 you should find this code:

< ?php else : // this is displayed if there are no comments so far ? >

Immediately before the above code, you’ll want to place this code:

<>Trackbacks
<>
< ?php foreach ($comments as $comment) : ? >
< ?php $comment_type = get_comment_type(); ? >
< ?php if($comment_type != 'comment') { ? >
<>< /li >
< ?php } ? >
< ?php endforeach; ? >
< /ol >

You can adjust this code to display how you want to, including using a different header if you have a specific look for your header 3.






http://i710.photobucket.com/albums/ww102/king_raavanan/5xaT5Afk6X.gif





Related Posts :



0 comments:

Post a Comment

Leave a Comments !

Your Name :
Your Email :
Subject :
Message :
Image (case-sensitive):

Chat Room

Create a Meebo Chat Room

Recent Updates!

Chat With Me !

Followers

Free Sms !

  © 2008 - 2009 Copyright Home | Subscriber | Contact | Help

Back to TOP