Wordpress:将“我的帐户”重命名为会员姓名

问题描述 投票:-3回答:1

如何将“我的帐户”重命名为会员姓名exp:“John”(参见下图):

enter image description here

我尝试过更改wp-content / themes / themeName / framework / functions / woo-account.php:

printf( __( '%s', 'wpdance' ),$current_user->user_lastname);

先前:

printf( __( 'My Account', 'wpdance' ));

但仍然没有工作。

谢谢。

wordpress woocommerce
1个回答
1
投票

只需转到YOUR_URL / wp-admin / edit.php?post_type = page,您将看到“我的帐户”页面(由WooCommerce自动创建)。重命名该页面,就是这样。

要显示当前用户的名称而不是“我的帐户”,请将此代码添加到functions.php文件中。

function rename_my_account( $title, $id = null ) {
    if ( $title=='My account' and is_user_logged_in()) {
        $current_user=wp_get_current_user();
        return $current_user->display_name;
    }
    return $title;
}
add_filter( 'the_title', 'rename_my_account', 10, 2 );
© www.soinside.com 2019 - 2024. All rights reserved.