I'm using WooCommerce with a child theme of Storefront.
I have a secondary menu named "Desktop secondary top right EN" where there's a link to "my account".
My question is: how to change the "my account" item wording if the customer is logged in ?
I'd like to do this without having to create another menu in the back office and without installing a plugin of course.
I should be able to use something similar to:
function menu_add_admin_buttons( $items, $args ) {
if( 'secondary' == $args['theme_location'] ) {
$btn_format = '<li><a href="%s">%s</a></li>';
if ( is_user_logged_in() ) {
$btn = sprintf($btn_format, admin_url('profile.php'), __('Your Profile') );
} else {
$btn = sprintf($btn_format, wp_login_url(), __('Log In') );
}
return $items . $btn;
}
}
$menu_filter = 'wp_nav_menu_' . sanitize_title("Desktop secondary top right EN") . '_items';
add_filter($menu_filter, 'menu_add_admin_buttons', 20, 2);
but it has to be customized to my needs. How can I do this?