Typecho 文章标题字数限定代码
我们在写模板的时刻许多时刻文章标题太长,会超越限定,固然我们可以用css代码来完成限定字数截断他。
实在我们typecho的代码也有限定标题字数的代码。下面我就通知人人如何做。
我就以侧边栏最新文章来演示:
在sidebar.php中将
<?php $this->widget('Widget_Contents_Post_Recent')->parse('<li><a href="{permalink}">{title}</a></li>'); ?>替换成
<?php $this->widget('Widget_Contents_Post_Recent')->to($post); ?><?php while($post->next()): ?><li><a href="<?php $post->permalink(); ?>"><?php $post->title(14, '.....'); ?></a></li>其他的相似道理一样。。。

评论列表