Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active November 30, 2021 10:38
Show Gist options
  • Save woogists/f552b765d9d447dea43be9e9eb07490b to your computer and use it in GitHub Desktop.
Save woogists/f552b765d9d447dea43be9e9eb07490b to your computer and use it in GitHub Desktop.
[Theming Snippets] Display my-account link in a template file
<?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 } ?>
@Basilou38
Copy link

must this file be added to which directory? How to configure wordpress to use this template ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment