- A+
所属分类:Typecho
Typecho导航菜单默认显示首页和关于等独立页面,Typecho后台创建的分类不会自动添加到导航菜单中,新手站长网分享将分类栏目添加到导航菜单中的方法:
Typecho分类添加到导航菜单的方法
将Typecho分类添加到导航菜单的方法很简单,只需要编辑header.php文件,将分类代码添加到header.php模板文件中即可,代码如下:
1 2 3 4 5 6 7 8 |
<?php $this->widget('Widget_Metas_Category_List')->to($category); ?> <?php while ($category->next()): ?> <a<?php if ($this->is('post')): ?> <?php if ($this->category == $category->slug): ?> class="current"<?php endif; ?> <?php else: ?> <?php if ($this->is('category', $category->slug)): ?> class="current"<?php endif; ?> <?php endif; ?> href="<?php $category->permalink(); ?>"><?php $category->name(); ?></a> <?php endwhile; ?> |
登录到Typecho后台--控制台--外观--编辑文件header.php,复制以上代码,粘贴到下图中的位置:

typecho导航菜单添加分类
然后点保存文件即可。
云服务器价格出炉,价格很低:
- 云服务器特价:阿里云服务器特惠57元起(全网最低价)
- 阿里云:阿里云代金券一键领取中...
- 腾讯云:腾讯云服务器秒杀特价88元一年起
- 免费提供技术支持:咨询客服