Skip to content

Instantly share code, notes, and snippets.

@SiR-DanieL
Last active December 22, 2023 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SiR-DanieL/0f0ba74665c07d2d4926699cf6c21d66 to your computer and use it in GitHub Desktop.
Save SiR-DanieL/0f0ba74665c07d2d4926699cf6c21d66 to your computer and use it in GitHub Desktop.
Adding the User Avatar in My Account Page
<?php
/**
* @snippet Adding the User Avatar in My Account Page
* @author Nicola Mustone
* @author_url https://nicolamustone.blog/2014/12/26/add-the-customer-avatar-in-my-account-page-in-storefront/
* @tested-up-to WooCommerce 8.4.X
*/
function nm_myaccount_customer_avatar() {
$current_user = wp_get_current_user();
echo '<div class="myaccount_avatar">' . get_avatar( $current_user->user_email, 128, '', $current_user->display_name ) . '</div>';
}
add_action( 'woocommerce_account_content', 'nm_myaccount_customer_avatar', 5 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment