• Resolved FortuneSix

    (@fortunesix)


    I am trying to do this.

    Displays a link to the user account section. If the user is not logged in the link will display ‘Login / Register’ and take the use to the login / signup page. If the user is logged in the link will display ‘My account’ and take them directly to their account.

    <?php if ( is_user_logged_in() ) { ?>
     	<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('My Account','woothemes'); ?>"><?php _e('My Account','woothemes'); ?></a>
     <?php }
     else { ?>
     	<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('Login / Register','woothemes'); ?>"><?php _e('Login / Register','woothemes'); ?></a>
     <?php } ?>

    http://docs.woothemes.com/document/display-my-account-link-in-a-template-file/

    But i can’t find the place to do that.

    Anyone?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Open header.php file and add code below as shown in the screenshot (http://screencast.com/t/oFXl3hlHzx)

    <div class="Woo-login">
     <?php if ( is_user_logged_in() ) { ?>
     	<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('My Account','woothemes'); ?>"><?php _e('My Account','woothemes'); ?></a>
     <?php }
     else { ?>
     	<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('Login / Register','woothemes'); ?>"><?php _e('Login / Register','woothemes'); ?></a>
     <?php } ?></div>

    After that use this CSS

    .Woo-login {
        text-align: right;
    }

    Thank You.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @gouravwptech Please do not recommend that anyone edit the theme’s header.php file directly. The user will lose their modifications when the theme is updated.

    @fortunesix You want to create and activate a child theme first then make a change like that in a copy of the header.php file in the child theme directory.

    https://codex.wordpress.org/Child_Themes

    Yes my mistake. I forgot to suggest child theme.
    Thank you @jan Dembowski

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Where is woocommerce template file?’ is closed to new replies.