1

I have a function that creates a bio-line at the top of every post. One part gets the avatar of that user, that he uploaded in WordPress (I use a plugin so people don't need to use Gravatar for this).

function mm_author_byline()
{
    if (is_single() AND (get_post_type() == 'post' OR get_post_type() == 'theme_product_review')) {
        ?>

        <div class="mm-byline-image">
            <?= get_avatar(get_the_author_meta('ID')) ?>
        </div>

        <?php
    }
}

The problem now is, that this image is neither cropped, nor is it sized down. It takes the original image, that can be huge. How can I get a sized down version of the avatar image?

2
  • I think nobody knows what plugin did you use for gravatar replacement, how it saves images etc...
    – anton
    Commented May 20, 2021 at 13:52
  • I used ProfilePress (used to be WP User Avatar) Commented May 20, 2021 at 14:16

1 Answer 1

1

get_avatar takes a second parameter according to the documentation for avatar size. If you're using a plugin that doesn't respect that, you'll need to reach out or check their documentation for a way to change the size.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.