php - Display logged-in User Avatar in Wordpress Nav Menu -


i'm using function display logged-in user name in wordpress navigation menu , display logged-in user avatar in menu couldn't find way this. i'm asking :) here function i'm using name:

function my_dynamic_menu_items( $menu_items ) {     foreach ( $menu_items $menu_item ) {         if ( '#current-username#' == $menu_item->title ) {             global $shortcode_tags;             if ( isset( $shortcode_tags['current-username'] ) ) {                 // or do_shortcode(), if must.                 $menu_item->title = call_user_func( $shortcode_tags['current-username'] );             }             }     }      return $menu_items; } add_filter( 'wp_nav_menu_objects', 'my_dynamic_menu_items' ); 

i have code in functions.php , call #current-username# in menu item, there way customise code output avatar? help.

try : echo get_avatar( $id_or_email, $size, $default, $alt );


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -