wordpress自定义页面title

wordpress自定义页面title

在functions中添加代码 :

function weihuan_www_title(){
    if ( is_home() ) { 
        return "首页";
    }elseif ( is_search() ) {
        return "搜索结果页面";
    }elseif ( is_single() ) {
        return trim(wp_title('',0));
    }elseif ( is_page() ) {
        return trim(wp_title('',0));
    }elseif ( is_category()) {
        return single_cat_title('',false);
    }elseif ( is_month() ) { 
        return the_time('F');
    }elseif (is_tag()) { 
        return single_tag_title("", false);
    }
}

前端header调用:

echo weihuan_www_title();

给TA打赏
共{{data.count}}人
人已打赏
程序使用

快速搭建framework7项目:使用脚手架创建app

2020-5-8 12:48:03

WordPress开发

用WordPress与uni-app开发,包含所有源代码

2019-6-14 16:24:35

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索