Change rendered avatar size (#318)

* Change rendered avatar size

Reduces the standard fetched avatar size, dependant on the format.

* Reverse image size
This commit is contained in:
Paul Kevan 2024-09-26 16:52:35 +01:00 committed by GitHub
parent 19b3897514
commit 04e5480425
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,9 +16,13 @@ $is_truncated = isset( $attributes['className'] ) && str_contains( $attributes['
// Initialize count to zero for untruncated view.
$count_more = 0;
// Set avatar size at smallest usage in px.
$avatar_size = 70;
if ( $is_truncated ) {
$count_more = count( $contributors ) - TRUNCATED_MAX;
$contributors = array_splice( $contributors, 0, TRUNCATED_MAX );
$avatar_size = 30;
}
?>
@ -31,7 +35,7 @@ if ( $is_truncated ) {
<li class="pledge-contributor">
<span class="pledge-contributor__avatar">
<a href="<?php echo esc_url( 'https://profiles.wordpress.org/' . $contributor->user_nicename . '/' ); ?>">
<?php echo get_avatar( $contributor->user_email, 280, 'mystery', $contributor->display_name ); ?>
<?php echo get_avatar( $contributor->user_email, $avatar_size, 'mystery', $contributor->display_name ); ?>
</a>
</span>
</li>