Forums

get_avatar suggesstion: get_avatar_src() (1 post)

  1. alkafy
    Member
    Posted 1 month ago #

    I have a rare situation where the avatar must be in an element's background-image css property instead of in an img tag. As is, I strip the image src using regex.

    A "get_avatar_src" function, like wp_get_attachment_image_src, would be useful here.

    Example:
    <div style="background-image:url('<?php echo get_avatar_src($user_id,32); ?>');" class="avatar"></div>

Reply

You must log in to post.

About this Topic

Tags