Typecho分类输出默认链接CSS样式修改

作者: 时间:
浏览 : 762

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文件里,可以找对应的代码进行详细修改。

Tag标签:

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注