I work on small project, and want to make this scenario to work on. I want to make when user is logged in the title of My Account page to write "My Account", and when is logged out, the title of page to write "Login Register". To explain better with images:
- For logged in users
- For non-logged in users
I have this code apply, but it seems do not change something.
function dynamic_label_change( $items, $args ) {
if ( ! is_user_logged_in() ) {
$items = str_replace( "My Account", "Account Login / Register ", $items );
}
return $items;
}
or maybe
// When user is on my account page and not logged in
if (is_account_page() && !is_user_logged_in()) {
echo '<h1 class="entry-title">'.__("My custom title",
"the_theme_slug").'</h1>'; // My custom title
} else {
the_title( '<h1 class="entry-title">', '</h1>' ); // the normal template
title
}
Any help?

