admin管理员组文章数量:1293565
How I can remove word "Archives" in head title in category page?
I'm using the Twenty Twelve theme and WordPress 4.
<head>
<title>"name of category" Archives | "name of sites"</title>
</head>
How I can remove word "Archives" in head title in category page?
I'm using the Twenty Twelve theme and WordPress 4.
<head>
<title>"name of category" Archives | "name of sites"</title>
</head>
Share
Improve this question
edited Sep 30, 2014 at 19:47
sidlo
asked Sep 30, 2014 at 11:04
sidlosidlo
1531 silver badge4 bronze badges
2
- I don't understand your question, and it seems that the user who answered your question also misunderstood you. Please add a snapshot of what you need to remove – Pieter Goosen Commented Sep 30, 2014 at 19:25
- I've edited the question. At category page I get this and I want to get rid of "Archives". – sidlo Commented Sep 30, 2014 at 19:49
3 Answers
Reset to default 6If you are using yoast SEO plugin then the easiest method is to remove the archive word from "titles & metas-> Taxonomies->category
"
find:
%%term_title%% Archives %%page%% %%sep%% %%sitename%%
replace it with:
%%term_title%% %%page%% %%sep%% %%sitename%%
Some points of interest:
- The code for
wp_title()
is located with /wp-includes/general-template.php. This function performs two filters:wp_title_parts
andwp_title
, and in either instance you have the opportunity to manipulate the results of the standardwp_title()
. - Look at functions.php within the theme; the function
twentytwelve_wp_title
performs some magic specific to twentytwelve, and is activated using thewp_title
filter with priority 10.
If you're not familiar with filters, I strongly recommend you look into it before getting too fancy with this. However, my suggested approach takes the following steps:
- Allow WP and twentytwelve to do their thing.
- Come along after the fact, and just before
wp_title()
returns its string we have an opportunity to manipulate it using thewp_title
filter.- For this to work, we'll need to assume a priority of greater than 10 to ensure that we do our thing after twentytwelve has done its part.
Thus, I suggest the following function, invoked using the wp_title
filter with a larger (executed later) priority of 11:
function overwrite_twentytwelve_archives_title($title, $sep)
{
// Look for the string " Archives" (note the leading space),
// and strip it out of $title:
return preg_replace("/ Archives/", "", $title);
}
add_filter("wp_title", "overwrite_twentytwelve_archives_title", 11, 2);
I took some liberty here in assuming that there would be an extra space in front of "Archives" that had to be stripped out as well (noted in the comments); adjust accordingly if you so desire. Basically, what I've suggested here is to allow Wordpress to go about its usual business, only to have the "Archives" bit stripped out just before it's actually displayed. Please note that I haven't tested this to work correctly, and if it doesn't I would be happy to put it through the ringer on my end.
Go this link (change www.yourwebsite with your domain )
www.yourwebsite/wp-admin/admin.php?page=wpseo_titles
then click on the tab : Taxonomies
The first tab is your target
本文标签: theme twenty twelveRemove Archives in category title
版权声明:本文标题:theme twenty twelve - Remove Archives in category title 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741579561a2386490.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论