admin管理员组文章数量:1122846
Yes, i've seen some answers on different questions but they didn't fit to my situation.
My theme has title tag enabled.
The title in the wp_get_document_title() function is different than the real title in my Search Page, which is "You Searched For %search% - %site_name%".
I need to translate the title, nothing more. I searched for You Searched in functions_php and every other .php file in woocommerce that has product or search related and couldn't find it.
I would appreciate any help. Thanks !
Yes, i've seen some answers on different questions but they didn't fit to my situation.
My theme has title tag enabled.
The title in the wp_get_document_title() function is different than the real title in my Search Page, which is "You Searched For %search% - %site_name%".
I need to translate the title, nothing more. I searched for You Searched in functions_php and every other .php file in woocommerce that has product or search related and couldn't find it.
I would appreciate any help. Thanks !
Share Improve this question asked Oct 24, 2017 at 17:42 FlavianoFlaviano 112 bronze badges 1- Many different plugins and themes can affect these in various ways. It may have nothing to do with WooCommerce - check any SEO plugins you have installed or deactivate all plugins, check the page title, activate one plugin at a time, check the title, to determine which (if any) plugin is setting it. – WebElaine Commented Oct 24, 2017 at 19:26
2 Answers
Reset to default 0In my case this problem was caused by Wordpress-Plugin Yoast Seo.
Take a look at your mySql-Database, Table wp_options and search for option_name = wpseo_titles
In the "option_value"-Field you can find the "You Searched for"-String and replace it by e.G. "Deine Suche nach"
Woocommerce and many themes provide filter hooks to modify various parts of the page, including the title tag.
You can create a custom function to modify the document title using the document_title_parts
filter hook.
function custom_search_page_title($title_parts) {
if (is_search()) {
$title_parts['title'] = sprintf(__('You Searched For %s - %s', 'your-text-domain'), get_search_query(), get_bloginfo('name'));
}
return $title_parts;
}
add_filter('document_title_parts', 'custom_search_page_title');
Replace your-text-domain
with the text domain of your theme or plugin.
To translate the title, you can use translation functions like __()
, esc_html__()
, or sprintf()
if you need to insert dynamic content like the search query.
本文标签: woocommerce offtopicChange the Title Tag of Search Products Page
版权声明:本文标题:woocommerce offtopic - Change the Title Tag of Search Products Page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736287359a1927862.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论