更改 Wordpress 标签页的标题 [英] Changing the title of Wordpress Tag Pages

查看:38
本文介绍了更改 Wordpress 标签页的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改我的 wordpress 博客标签页的标题.我想要做的是将标签名称保留为仅标题.

I wish to change the title of Tags pages of my wordpress blog. What I want to do is to keep the Tag name as it's title only.

例如:如果标签名称是Wordpress Tag Pages Tutorial",那么该标签应该具有相同的标题Wordpress Tag Pages Tutorial"而不是Blog Name - Wordpress Tag Pages"教程" 那么这段代码有什么变化?我尝试过,但在 wordpress 标题中只显示变量名称等错误.

For example: If a tag name is "Wordpress Tag Pages Tutorial" then that tag should have the same title "Wordpress Tag Pages Tutorial" instead of "Blog Name - Wordpress Tag Pages Tutorial" so what to change in this code? I have tried but showing errors like only variables name in wordpress title.

<title>
<?php if (is_home () ) { bloginfo('name'); }elseif ( is_category() ) {
single_cat_title(); echo ' - ' ; bloginfo('name'); }
elseif (is_single() ) { single_post_title();}
elseif (is_page() ) { bloginfo('name'); echo ': '; single_post_title();}
else { wp_title('',true); } ?>

推荐答案

您缺少 is_tag().

示例:

if ( is_tag() ) {
    $tag = single_tag_title("", false);
    echo $tag;
}

这篇关于更改 Wordpress 标签页的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆