Trackbacks are one way of telling the web authors that another site links back to one of their articles,
posts and the like. This helps the authors know who is linking to their articles. WordPress happens to be one of the blogging platforms that support automatic pingbacks or trackbacks.
So, why do you have to separate trackbacks from the comments then? One reason is to make things look more tidy. Isn't it nicer to see all the apples in one row and the oranges in the other than see them mixed altogether on a fruit stand? Besides the comments are the thoughts shared by real people, and you, the one reading them, just don't want to be interrupted with those machine-generated linkbacks in between.
Here's now a simple way of segregating comments and trackbacks. In this hack we will be editing comments.php. And before anything else, you should always create a backup copy of the file or simply just the code.
Step 1
Now open comments.php, and look for the following code:
<?php foreach ($comments as $comment) : ?>After that, paste this:
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type == 'comment') { ?>
EXPLANATION:
In the code we added, line 1 means that we will get the type (comment or trackback) of all the comments it parses for the specific post. Then line 2 will filter and show only the ones with the type comment. Thus your comments will be posted as normal but without the trackbacks or pingbacks along.
Step 2
Search for:<?php endforeach; /* end for each comment */ ?>Then before the above code, add this:
<?php } else { $trackback = true; } /* End of is_comment statement */ ?>
EXPLANATION:
The appended line of code means that if it has filtered comments with type trackback, it shall set the variable $trackback to true, but nothing of those trackbacks will appear still. Don't worry we really didn't discard those precious trackbacks completely because we've got another way of handling them which we will do in the succeeding step.
Step 3
Look for this code:<?php else : // this is displayed if there are no comments so far ?>Before it, paste the code below:
<?php if ($trackback == true) { ?>
<h3>Trackbacks</h3>
<ol>
<?php foreach ($comments as $comment) : ?>
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type != 'comment') { ?>
<li><?php comment_author_link() ?></li>
<?php } ?>
<?php endforeach; ?>
</ol>
<?php } ?>
EXPLANATION:
In line 1, if there are trackbacks found then it shall execute the inside code. "Trackbacks" in line 2 will be the title header for the trackbacks or pingbacks section. As you can see, "Trackbacks" will only appear if there are any trackbacks or pingbacks available. Then the rest of the code is the default way of rendering trackbacks which is just similar to comments (like having its author, author's link, etc).
You're done! Try refreshing your blog and see if it works. This hack would only be useful if you really are using trackbacks or pingbacks with your posts. So have fun.
















"Wonderful Hand Painting Artwork by Guido Daniele!"
"55 Awesome Country and Tourism Logos!"
"A Collection of the Most Creative, Clever and Interactive Business Cards Designs!"
"The Amazing Contrast Between Pencil Drawing and Real Photos by Ben Heine"
"50 Perfectly Timed Animal Photographs!"
"The Biggest Collection of the Most Controversial, Creative and Clever Ads Ever!"
"30 Wonderful Infinity Edge Pools From Around The World!"
"Super Realistic Paintings That Look Like Photographs"
"40 Amazing Places To Visit From All Around The Globe!"
"The Ultimate WordPress Resources Guide!"
"70 Wonderful Examples of Street Art!"
"100+ Clever Logos With Hidden Symbolism"
"90+ Extremely Clever, Creative and Sexy Ads Examples!"
"30 Examples of Bent Objects Artwork Creations!"
"15 Harmless Weapons Made From Everyday Objects in the Name of Peace to all Mankind!"
"20 Amazing Celebrity Caricatures by Anthony Geoffroy!"
"The Most Anticipated Gadgets of 2012!"
"The 84th Academy Awards – The Complete List of Oscars Nominees and Winners"
"The Top 10 Best WordPress Theme Frameworks"
"Top 20 Most Expensive Keywords and the Highest CPC Keywords List!"
"10 Best Alternate options To Adobe Illustrator"
"118 Awesome Futuristic-Themed Fonts!"
"Retrospective and Prospective Look at Famous Logos"
"U.S. Researchers Discover a New Planet Covered Almost Entirely with Water!"
"Japanese Company Plans on Building an Outer Space Tourists Elevator!"
"Barnes & Noble Reveals a $199 Nook Tablet"
"44 Valuable and Beneficial Adobe Illustrator Tutorials!"
"Pile Up of iPad 3 Latest Rumors to Date!"
"Sony PlayStation Vita Debuts in the US and Europe on the 22nd of February, 2012!"
"Fantastic Pumpkin Carvings by Ray Villafane!"
The "Incredible 3D Pencil Drawings by the Extremely Talented Young Fredo!"
The “The 5 Most Gifted 3D Pavement chalk artists in the World!"
The “READ – DO – RANK” Method
80 Kurt Wenner Breathtaking 3D Street Art Chalk Drawings
A Full and Comprehensive List of Free Tools, Guides and Resources!
47 Jaw-Dropping Julian Beever’s 3D Pavement Drawings!
65 Digital Art Inspiring Masterpieces of Nik Ainley
20 Amazing Beach Vector Illustrations Wallpapers!
10 Most Anticipated Video Games of 2012!
50 Awesome Social Media Badges!
334 Windows 8.0 Icons to Drool Over!
27 Popular and Most Played Role-Playing Games
Top 100 XBOX 360 Games
100+ Stunningly Beautiful Space Wallpapers
80 Ultimately Beautiful Macro Photography Shots
70 Most Downloaded FREE Wordpress Themes
How to Improve Website's Security Using .htaccess
55 FREE and Extraordinary Gothic Fonts
FREE and Premium Formal Script Fonts
Separating Comments and Trackbacks
Top 10 Alien Photo Manipulation Tutorials
The Ultimate Online Color Tools for Web Designers
40 Best Online Photo Editors
42 Photoshop Grunge Brush Sets
65 High Quality Apple Computer Wallpapers
Latest iPods: Unleash the Power of Music!
550+ Astounding Apple iPhone Wallpapers
11 Useful Video Tutorials on iPhone 3G/3GS
Beautiful Social Networking Icons
55 Cool and Free Social Media Network Icon Packs
480+ FREE and Fresh Twitter Icons