首页CMS通用Typecho代码实现面包屑导航的效果(PHP代码实现)

通用Typecho代码实现面包屑导航的效果(PHP代码实现)

时间2024-05-22 06:54:03发布访客分类CMS浏览950
导读:有些默认的Typecho主题模板里是没有面包屑导航的,这个对于SEO效果不够好,这里老蒋整理到一个常用的PHP代码实现的通用Typecho面包屑导航,整理收藏,如果有需要可以使用。具体代码如下:<div class="breadcru...

有些默认的Typecho主题模板里是没有面包屑导航的,这个对于SEO效果不够好,这里老蒋整理到一个常用的PHP代码实现的通用Typecho面包屑导航,整理收藏,如果有需要可以使用。

具体代码如下:

div class="breadcrumb">
    ?php if($this->
    is('index')):?>
    !-- 页面首页时 -->
    a href="?php $this->
    options->
    siteUrl();
     ?>
    " title="?php $this->
    options->
    title();
     ?>
    ">
    首页/a>
     &
    gt;
    ?php elseif ($this->
    is('post')): ?>
    !-- 页面为文章单页时 -->
    a href="?php $this->
    options->
    siteUrl();
     ?>
    " title="?php $this->
    options->
    title();
     ?>
    ">
    首页/a>
     &
    gt;
     ?php $this->
    category();
     ?>
     &
    gt;
     ?php $this->
    title();
     ?>
    ?php else: ?>
    !-- 页面为其他页时 -->
    a href="?php $this->
    options->
    siteUrl();
     ?>
    " title="?php $this->
    options->
    title();
     ?>
    ">
    首页/a>
     &
    gt;
     ?php $this->
    archiveTitle(' &
    raquo;
     ','','');
     ?>
    ?php endif;
     ?>
    /div>
    

完成代码撰写后,我们把他们添加到需要显示面包屑位置对应的模板文件中即可,如header.php。

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: 通用Typecho代码实现面包屑导航的效果(PHP代码实现)
本文地址: https://pptw.com/jishu/665420.html
绝对定位使元素的位置与文档流无关,因此不占据空间 利用Typecho函数调用自定义分类内容显示方法

游客 回复需填写必要信息