Typecho将分类添加到导航菜单中

作者: 时间:
浏览 : 783

Typecho默认是将单页面链接显示在导航菜单中,如何将分类添加到导航菜单中?将以下代码加在header.php即可:

<?php $this->widget('Widget_Metas_Category_List')->to($category); ?>
<?php while($category->next()): ?>
<li<?php if($this->is('category', $category->slug)): ?> class="current"<?php endif; ?>><a href="<?php $category->permalink(); ?>"><?php $category->name(); ?></a></li>
<?php endwhile; ?>

 

Tag标签:

《“Typecho将分类添加到导航菜单中”》 有 1 条评论

  1. iremex

    您好,使用这个代码在header.php中,有二级分类,结果一级二级分类都出来了,并且错位了,怎么解决呢?

回复 iremex 取消回复

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