カテゴリー
WordPress

ユーザーアバターの表示方法

表示させるだけなら。

$current_user = wp_get_current_user();
echo get_avatar($current_user->ID, 56);

色々こねこね。

$current_user = wp_get_current_user();
              $args = array(
                  'height'    => '56',
                  'width'     => '56',
                  'class'     => array('img-class', 'profile-class')
              );
              $alt = $current_user->user_firstname . '\'s Avatar';
              printf( '<a href="%s">%s</a>', get_edit_user_link($current_user->ID), get_avatar($current_user->ID, 56, null, $alt, $args) );

関数リファレンス/get avatar
https://wpdocs.osdn.jp/関数リファレンス/get_avatar

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です