Typecho分类输出默认链接CSS样式修改
Typecho分类输出默认的样式是有ul、li的列表样式的html,如下:
<ul class="widget-list"><li class="category-level-0 category-parent"><a href="">产品</a> <ul class="widget-list"> <li class="category-level-1 category-child category-level-odd"><a href="">产品1</a></li> <li class="category-level-1 category-child category-level-odd"><a href="">产品2</a></li> </ul> </li><li class="category-level-0 category-parent"><a href="">新闻</a> <ul class="widget-list"> <li class="category-level-1 category-child category-level-odd"><a href="">新闻1</a></li> <li class="category-level-1 category-child category-level-odd"><a href="">新闻2</a></li> </ul> </li></ul>
我们可以通过修改调用函数,输出以下不带列表的链接样式:
<a class="category-level-0 category-parent" href="">产品</a> <a class="category-level-1 category-child category-level-odd" href="">产品1</a> <a class="category-level-1 category-child category-level-odd" href="">产品2</a> <a class="category-level-0 category-parent" href="">新闻</a> <a class="category-level-1 category-child category-level-odd" href="">新闻1</a> <a class="category-level-1 category-child category-level-odd" href="">新闻2</a>
方法是找到以下代码:
<?php $this->widget('Widget_Metas_Category_List')->listCategories('wrapClass=widget-list'); ?>
替换为以下代码:
<?php $this->widget('Widget_Metas_Category_List')->to($category); ?> <?php while ($category->next()): ?> <a href="<?php $category->permalink(); ?>"><?php $category->name(); ?></a> <?php endwhile; ?>
如果需要更详细个性的修改,具体的分类输出函数的文件在/var/Widget/Metas/Category/List.php文件里,可以找对应的代码进行详细修改。
- Typecho将分类添加到导航菜单中
- Typecho首页和分类页调用文章内容截取
- Typecho自定义title标题SEO优化
- Typecho伪静态规则及301跳转设置
- Typecho在文章中插入广告代码投放广告
本文标题:《Typecho分类输出默认链接CSS样式修改》
网址:https://zhangwenbao.com/typecho-category-outputs-the-default-link-css-style-modification.html