酷秀博客
首页/给你的typecho分类添加缩略图标教程

给你的typecho分类添加缩略图标

admin的头像admin7个月前教程160热度

把下面的代码添加到“functions.php”文件中

$fenlei = new \Typecho\Widget\Helper\Form\Element\Textarea(
'fenlei',
null,
null,
_t('分类图标'),
_t('可以通过这里自定义分类图标,多个请用|进行分隔。列如:http://xx.xx/xx.png|http://xx.xx/xx.png')
);

$form->addInput($fenlei);

模板中分类图标调用代码如下

<?php $fenleiimg = explode('|',rtrim($this->options->fenlei,'|')); ?>
<?php $this->widget('Widget_Metas_Category_List')->to($categorys); ?>
<?php $i = 0; while($categorys->next()): ?>


name(); ?>



签名: 最忠诚的BUG开发者来自: 重庆市. Chrome浏览器
文章目录