Thank you very much for your quick help and contribution.
I’m sorry I can’t share the url because I’m still working on it on local host before buying a domain.
I have modified your code to be able to use dashicons.
But first you have to enter the following code in the functions.php file of the child theme so that the theme can display the dashicons:
//Worpress dashicons are compatible with the theme
add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
function load_dashicons_front_end() {
wp_enqueue_style( 'dashicons' );
}
Below is the modified code that you have provided me:
/**
* Customize HTML for login/logout menu avatar.
*
* @param string $avatar_html The avatar HTML.
* @param string $username The username.
* @param string $avatar_url The URL of the avatar image.
* @return string Modified avatar HTML.
*/
function custom_login_logout_avatar_html( $complete_img, $avatar_html, $username, $avatar_url ) {
// Create an <img> tag with the provided information
$avatar_html = '<span class="dashicons dashicons-admin-users"></span>' . esc_attr( $username );
return $avatar_html;
}
add_filter( 'login_logout_menu_avatar_html', 'custom_login_logout_avatar_html', 10, 4 );
Note: I am not fluent in the English language. My writing is a translation made with Google Translate. I apologize if anything is not clear.
Thank you so much
-
This reply was modified 8 months ago by
elnoi.