Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_admin_bar_my_account_menu [ WordPress Function ]

wp_admin_bar_my_account_menu ( $wp_admin_bar )
Defined at:



Add the "My Account" submenu items.

Source


<?php
function wp_admin_bar_my_account_menu$wp_admin_bar ) {
    
$user_id      get_current_user_id();
    
$current_user wp_get_current_user();
    
$profile_url  get_edit_profile_url$user_id );

    if ( ! 
$user_id )
        return;

    
$wp_admin_bar->add_group( array(
        
'parent' => 'my-account',
        
'id'     => 'user-actions',
    ) );

    
$user_info  get_avatar$user_id64 );
    
$user_info .= "<span class='display-name'>{$current_user->display_name}</span>";

    if ( 
$current_user->display_name !== $current_user->user_nicename )
        
$user_info .= "<span class='username'>{$current_user->user_nicename}</span>";

    
$wp_admin_bar->add_menu( array(
        
'parent' => 'user-actions',
        
'id'     => 'user-info',
        
'title'  => $user_info,
        
'href'   => $profile_url,
        
'meta'   => array(
            
'tabindex' => -1,
        ),
    ) );
    
$wp_admin_bar->add_menu( array(
        
'parent' => 'user-actions',
        
'id'     => 'edit-profile',
        
'title'  => __'Edit My Profile' ),
        
'href' => $profile_url,
    ) );
    
$wp_admin_bar->add_menu( array(
        
'parent' => 'user-actions',
        
'id'     => 'logout',
        
'title'  => __'Log Out' ),
        
'href'   => wp_logout_url(),
    ) );
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics