Clanbite

clanbite_players_get_player_avatar_img_html( int $user_id, array $args = array() ): string

Builds a single <img> tag for a player avatar using clanbite_players_get_display_avatar().

Prefer this over hand-built <img> markup in templates and blocks so attribute and inner markup hooks run consistently. Wrap or extend output with clanbite_players_apply_player_avatar_display_markup().

Parameters

$user_id (int) Required

WordPress user ID.

$args (array) Optional

Optional. Arguments.

Default: array()

  • $preset string Optional. large, medium, or small (Players settings). Overrides size when set.
  • $size string|array Image size when preset is empty. Default resolves to large preset.
  • $context string Surface key for URL/img hooks. Default ''.
  • $class string Class attribute (full string). Default clanbite-player-avatar__img.
  • $alt string Alt text. Default from display name + translated “player avatar”.
  • $suppress_filters bool Same as clanbite_players_get_display_avatar(). Default false.
  • $loading string loading attribute. Default lazy. Use empty string to omit.
  • $decoding string decoding attribute. Default async. Use empty string to omit.
  • $width int If positive, output width attribute.
  • $height int If positive, output height attribute.
  • $presentational bool When true, alt="" and aria-hidden="true" (e.g. avatar inside a named button or link with visible text).

Returns

string HTML fragment or empty string when no URL resolves.

Defined in inc/extensions/players/functions.php