Last active
December 22, 2023 16:41
-
-
Save SirDarcanos/0f0ba74665c07d2d4926699cf6c21d66 to your computer and use it in GitHub Desktop.
Adding the User Avatar in My Account Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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