重命名Woocommerce中“我的帐户”选项卡式菜单项 [英] Rename My account tabbed menu items in Woocommerce

查看:346
本文介绍了重命名Woocommerce中“我的帐户”选项卡式菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在使用Wordpress版本4.9.8并启用了Woocommerce插件。我需要在我的帐户页面中将选项卡名称仪表板重命名为我的奖励。

I am currently using Wordpress Version 4.9.8 and enabled Woocommerce plugin. I need to rename the tab name "Dashboard" to "My Rewards" in My account pages.

我找到了以下代码,但似乎无法正常工作:

I found the code below, but it doesn't seem to be working:

function wpb_woo_endpoint_title( $title, $id ) {
   if ( is_wc_endpoint_url( 'dashboard' ) && in_the_loop() ) { // add your endpoint urls
     $title = "My Rewards"; // change your entry-title
     return $title;
}
add_filter( 'the_title', 'wpb_woo_endpoint_title', 10, 2 );

我们将不胜感激。

推荐答案

尝试以下方法代替(自2.6版起在Woocommerce中适用)

add_filter( 'woocommerce_account_menu_items', 'custom_my_account_menu_items', 22, 1 );
function custom_my_account_menu_items( $items ) {
    $items['dashboard'] = __("My Rewards", "woocommerce");
    return $items;
}

此代码位于您的活动子主题(或活动主题)的function.php文件中主题)。经过测试并有效。

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

这篇关于重命名Woocommerce中“我的帐户”选项卡式菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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