2014-05-16 51 views

回答

0

每文檔,與get_avatar方法組合(46是大小):http://codex.wordpress.org/Function_Reference/get_currentuserinfo

功能分配一個值到$ CURRENT_USER,不用戶數據$。這裏是你更新的代碼

<?php 
     global $current_user; 
     get_currentuserinfo(); 
     echo get_avatar($current_user->ID, 46); 
?> 

但我想補充一點,你也可以跳過這一使用方法get_current_user_id:http://codex.wordpress.org/Function_Reference/get_current_user_id

<?php 
    echo get_avatar(get_current_user_id(), 46); 
?> 
+0

犯規工作。我嘗試過但沒有結果。它不拉圖像 –

0

這爲我工作:

<figure class="alignnone"> 
       <?php 
        global $current_user; 
        if (is_user_logged_in()): 
        wp_get_current_user();  
        echo get_avatar($current_user->ID, 250); 
        endif; 
       ?> 
</figure>