HOWTO : Separare commenti e trackbacks in WordPress | Flavio's blog
 

HOWTO : Separare commenti e trackbacks in WordPress

in webdesign, Web 2.0 & SEO | | 3 Comments » | Last modified:

wordpresstitle

One of the things I miss now, in Wordpress, was able to distinguish trackbacks, unnecessary for the purposes of the discussion, by comments.

Show together is creating confusion, and you can not understand what are the comments “human” and which automatically generated by backlinks.

Fortunately I solved with this Article in English, I have personally tested and then I'm going to explain step by step, in Italian:

First of all DON’T DO IT UNLESS YOU KNOW WHAT ARE YOU DOING!!, or edit the php code in the template, require at least a basic knowledge of php, to understand where you're putting your hands, to avoid unpleasant problems.

In the folder of your template used in WP, open the comments.php and:

1) locate this line of code:

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

immediately BEFORE and paste this code:

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

2) Drop down to locate this code:

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

immediately BEFORE and paste this:

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

This will ensure that trackbacks are REMOVED from the list of comments.
Now we must show them in a dedicated space.

3) Immediately before the code to find the point 2, You should find this line:

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

found? well, Paste the following code BEFORE the newly found:

<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>

Perfect! Now you have to save and upload the comments.php, and you can see for yourself that you will trackbacks went to their place in a dedicated space, AFTER comments.

It seems to me a much cleaner and allows easy reading of the comments.

Tips or questions? Write us a comment!

 

3 Comments »

Please accept third-party cookies to be able to comment on the post! The CHANGE COOKIE CHOICES button is located in the footer of the site. / In order to comment this post, please accept the third party cookies! The button CAMBIA LE SCELTE DEI COOKIE is in the footer of the website.