全球主机交流论坛

标题: Typecho导航栏显示独立页面怎么改成显示分类 [打印本页]

作者: gman34    时间: 2020-3-31 16:12
标题: Typecho导航栏显示独立页面怎么改成显示分类
本帖最后由 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; ?>
复制代码


(, 下载次数: 0)

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

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


在去找个还在更新的开源主题吧,这个改来改去太麻烦
作者: gman34    时间: 2020-3-31 16:17
https://github.com/postbird/typecho-bootstrap-blog

这个开源的主题,有没有改过的?
作者: 鲁迅    时间: 2020-3-31 16:23
写成html放进去简单。
作者: 木易酱    时间: 2020-3-31 16:54
就是把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; }?>
复制代码

作者: gman34    时间: 2020-3-31 16:57
木易酱 发表于 2020-3-31 16:54
就是把page和pages换成category

(, 下载次数: 1)

改过很多次了,不是报错就是排版乱了
作者: im286    时间: 2020-3-31 17:24
还不错啊!!!!我也学习
作者: 32MB.CN    时间: 2020-3-31 18:07
我翻了一下我写的代码
  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>
复制代码

作者: gman34    时间: 2020-3-31 18:44
32MB.CN 发表于 2020-3-31 18:07
我翻了一下我写的代码

(, 下载次数: 1)
作者: 32MB.CN    时间: 2020-3-31 19:10
gman34 发表于 2020-3-31 18:44

你要根据自己的页面修改啊,我这主题是二级菜单啊
作者: gman34    时间: 2020-3-31 20:06
32MB.CN 发表于 2020-3-31 19:10
你要根据自己的页面修改啊,我这主题是二级菜单啊

不改了,找了个其它主题,太麻烦




欢迎光临 全球主机交流论坛 (https://hostloc-workers.ikyomon.com/) Powered by Discuz! X3.4