2 comments

  1. WordPress has a built in function to check if a user is logged in.

    <?php
        //Built in WordPress function that checks if the user is signed in
        if ( is_user_logged_in() ) {
            //If the user is logged in
            echo '<h1>Logged in title</h1>';
        } else {
           //If user is not logged in
           echo '<h1>Not logged in title</h1>';
        }
    ?>
    

    You will need to modify the Woocommerce template by overriding it.

    Example: To override the admin order notification, copy: woocommerce/templates/emails/admin-new-order.php to yourtheme/woocommerce/emails/admin-new-order.php
    
  2. —-(Update)—-

    I was wrong… Woocommerce My account is a page. The <h1>page title</h1> is the title of your page, so you will need to change it, in the wordpress template for pages in your theme (Each theme is different) and not in woocommerce templates.

    Once you have found this template in your theme folder, you will use a conditional in an if statement around the <h1>page title</h1>:

    // 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
    }
    

    This code is just a closer example, you will need to customize it a bit…

Comments are closed.