typecho输出二级导航和独立页面

一级分类导航代码

<?php $this->widget('Widget_Metas_Category_List')->to($category); ?>
<?php while($category->next()): ?>
<a href="<?php $category->permalink(); ?>" title="<?php $category->name(); ?>"><?php $category->name(); ?></a>
<?php endwhile; ?>

独立页面

<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while($pages->next()): ?>
<a<?php if($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?> href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
<?php endwhile; ?>

二级分类导航代码

<?php $this->widget('Widget_Metas_Category_List')->to($categorys); ?>
<?php while($categorys->next()): ?>                        
<?php if ($categorys->levels === 0): ?>
<?php $children = $categorys->getAllChildren($categorys->mid); ?>
<?php if (empty($children)) { ?>
 <li class="header__nav-item">    <a href="<?php $categorys->permalink(); ?>" class="header__nav-link"><?php $categorys->name(); ?></a></li>
<?php } else { ?>
<li class="header__nav-item"><a class="dropdown-toggle header__nav-link" href="#" role="button" id="dropdownMenuProjects" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?php $categorys->name(); ?></a>
<ul class="dropdown-menu header__dropdown-menu" aria-labelledby="dropdownMenuProjects">
<li><a href="<?php $categorys->permalink(); ?>"><?php $categorys->name(); ?></a></li>
<?php foreach ($children as $mid) { ?>
<?php $child = $categorys->getCategory($mid); ?>
<li><a href="<?php echo $child['permalink'] ?>"><?php echo $child['name']; ?></a></li>
<?php } ?>
</ul></li>
<?php } ?>
<?php endif; ?>
<?php endwhile; ?>
© 版权声明
THE END
如果喜欢,可以【点赞】【分享】【收藏】
点赞6赞赏分享
评论 抢沙发
头像
非注册用户需审核通过后才能查看。友好交流,勿发纯表情,勿恶意灌水!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容