全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 889|回复: 9

Typecho导航栏显示独立页面怎么改成显示分类

[复制链接]
发表于 2020-3-31 16:12:16 | 显示全部楼层 |阅读模式
本帖最后由 gman34 于 2020-3-31 16:32 编辑

显示独立页面怎么改成显示分类:

  1.                         <?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
  2.                         <?php while ($pages->next()): ?>
  3.                             <li class="nav-item">
  4.                                 <a class="nav-link" href="<?php $pages->permalink(); ?>"
  5.                                    title="<?php $pages->title(); ?>"><span><?php $pages->title(); ?></span></a>
  6.                             </li>
  7.                         <?php endwhile; ?>
复制代码


主题.png (38.85 KB, 下载次数: 0)

https://github.com/postbird/typecho-bootstrap-blog

这个开源的主题,有没有改过的?


在去找个还在更新的开源主题吧,这个改来改去太麻烦
 楼主| 发表于 2020-3-31 16:17:31 | 显示全部楼层
https://github.com/postbird/typecho-bootstrap-blog

这个开源的主题,有没有改过的?
发表于 2020-3-31 16:23:56 | 显示全部楼层
写成html放进去简单。
发表于 2020-3-31 16:54:55 | 显示全部楼层
就是把page和pages换成category
  1. <?php $this->widget('Widget_Metas_Category_List')->to($category); ?>
  2. <?php while($category->next()): ?>
  3. <li><a<?php if($this->is('category', $category->slug)): ?> class="current"<?php endif; ?> href="<?php $category->permalink(); ?>" title="<?php $category->name(); ?>"><?php $category->name(); ?></a></li>
  4. <?php endwhile; }?>
复制代码
 楼主| 发表于 2020-3-31 16:57:43 | 显示全部楼层
木易酱 发表于 2020-3-31 16:54
就是把page和pages换成category

90.png (3.53 KB, 下载次数: 1)

改过很多次了,不是报错就是排版乱了
发表于 2020-3-31 17:24:34 | 显示全部楼层
还不错啊!!!!我也学习
发表于 2020-3-31 18:07:54 | 显示全部楼层
我翻了一下我写的代码
  1.         <li class="menu-item -hasSubmenu"><a href="#"><?php _e('分类');?></a>
  2.             <ul>
  3.                 <?php $this->widget('Widget_Metas_Category_List')->to($category);?>
  4.                 <?php while ($category->next()): ?>
  5.                     <li><a<?php if ($this->is('category', $category->slug)): ?> class="current"<?php endif;?> href="<?php $category->permalink();?>" title="<?php $category->name();?>"><?php $category->name();?></a></li>
  6.                 <?php endwhile;?>
  7.             </ul>
  8.         </li>
复制代码
 楼主| 发表于 2020-3-31 18:44:18 | 显示全部楼层
32MB.CN 发表于 2020-3-31 18:07
我翻了一下我写的代码

ty3.png (3.16 KB, 下载次数: 1)
发表于 2020-3-31 19:10:45 | 显示全部楼层

你要根据自己的页面修改啊,我这主题是二级菜单啊
 楼主| 发表于 2020-3-31 20:06:08 | 显示全部楼层
32MB.CN 发表于 2020-3-31 19:10
你要根据自己的页面修改啊,我这主题是二级菜单啊

不改了,找了个其它主题,太麻烦
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-27 09:23 , Processed in 0.120528 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表