在Woocommerce中更改“我的帐户”页面上的标题 [英] Changing the titles on My Account pages in Woocommerce

查看:383
本文介绍了在Woocommerce中更改“我的帐户”页面上的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了很多有关如何使用WooCommerce我的帐户仪表板重新排序/更改导航和页面的示例。但是我无法终生解决如何更改每个部分的主要标题(我的帐户,订单,下载,地址等)。

I've seen loads of example of how to re-order / change the navigation and page with the WooCommerce my account dashboard. But i can't for the life of me work out how to change the main titles for each section (My Account, Orders, Downloads, Addresses etc).

我' ve搜索了模板,但没有喜悦。我尝试使用条件php注释回显正确页面的标题。但这不起作用,因为我的帐户部分使用了端点。我尝试添加过滤器,但没有任何乐趣。有人知道如何更改这些标题吗?

I've searched through the templates but no joy. I've tried using conditional php comments to echo the titles for the correct page. But it doesn't work because my account section uses endpoints. I've tried adding a filter, but no joy. Anyone got any idea how i change these titles?

谢谢

推荐答案

可以使用复合过滤器挂钩 woocommerce_endpoint _ {$ endpoint} _title 来完成。

It can be done using the composite filter hook woocommerce_endpoint_{$endpoint}_title.

例如,如果您需要更改我的帐户 **帐户详细信息**标题,则将使用(端点为编辑帐户

For example if you need to change the My Account "** Account details**" title you will use (where the endpoint is edit-account):

add_filter( 'woocommerce_endpoint_edit-account_title', 'change_my_account_edit_account_title', 10, 2 );
function change_my_account_edit_account_title( $title, $endpoint ) {
    $title = __( "Edit your account details", "woocommerce" );

    return $title;
}

代码进入活动子主题(或活动主题)的function.php文件)。经过测试并有效。

Code goes in function.php file of your active child theme (or active theme). Tested and works.

这篇关于在Woocommerce中更改“我的帐户”页面上的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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