Typecho 的批评显现区默许是访客批评和援用公告放在一块地区的,这类显现体式格局大概很多人不喜欢,博客吧也不喜欢,由于堆在一块会显得很杂沓,毕竟援用公告的款式和批评的款式是有差别的,博客簿当前的主题模板也是把批评地区和援用公告域名分开开来的。下面引自Typecho官方相干代码引见下分享文章批评和援用公告。
Typecho 掌握批评的范例的代码:
显现悉数(默许),即显现comment、trackback、pingback
<?php $this->comments()->to($comments); ?>
只显现comment
<?php $this→comments('comment')→to($comments); ?>只显现trackback
<?php $this→comments('trackback')→to($trackbacks); ?>只显现pingback
<?php $this→comments('pingback')→to($pingbacks); ?>
Typecho 分享文章批评和援用公告:
对主题模板 comments.php 文件举行编辑操纵,在其中找到显现悉数的语句,然后对其举行修正,也就是把显现悉数的语句换成只显现批评:
123456789101112131415
<?php $this->comments('comment')->to($comments); ?><!-- 症结 --><?php if ($comments->have()) : ?><ol> <?php while ($comments->next()) : ?><li id="<?php $comments->theId() ?>"><div class="comment_data"> <?php $comments->gravatar(32, '', '', 'avatar'); ?><span><?php $comments->author() ?></span> Says:<br /> <?php $comments->date('F jS, Y'); ?> at <?php $comments->date('h:i a'); ?></div><div class="comment_text"><?php $comments->content() ?></div></li> <?php endwhile; ?></ol><?php endif; ?>然后输出 pingback,pingback 并不需要那么多的展现内容,假定只展现标题和日期,则修正代码以下
1234567891011
<?php $this->comments('pingback')->to($pingbacks); ?><!-- 症结 --><?php if ($pingbacks->have()) : ?><h3>Pingbacks</h3><ol> <?php while ($pingbacks->next()) : ?><li id="<?php $pingbacks->theId() ?>"> <?php $pingbacks->author() ?> <?php $pingbacks->date('F jS, Y'); ?></li> <?php endwhile; ?></ol><?php endif; ?>把输出 pingback 的代码与输出批评的代码放在差别的位置即可。也能够分别为它们增加CSS款式。
同理,假如要显现 trackback,可按如上的修正要领

评论列表