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

查看:41
本文介绍了更改 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).

我已经搜索了模板,但没有任何乐趣.我尝试使用条件 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.

例如,如果您需要更改我的帐户**帐户详细信息**"标题,您将使用(端点为 edit-account):

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天全站免登陆