从评论中分离Trackbacks引用

默认情况下,是作为一条评论显示在评论列表中的. 如果把它们从评论中分离出来,看上去会更加的直观和漂亮,下面我们来看下是如何实现应用是如何从评论中分离的。

打开主题里的comments.php 文件,并搜索以下行:

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

在后面加上如下代码:

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

然后继续搜索如下代码:

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

在前面加入如下代码:

<?php } else { $trackback = true; } /* End of is_comment statement */ ?>

在继续搜索如下代码:

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

在前面加入:

<?php if ($trackback == true) { ?>
<h3></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 } ?>

保存comments.php 文件,大功告成,现在你看下,你的引用和评论是不是分离了呢?

Share/Save/Bookmark

Related Posts Preference

Leave a Reply