• Resolved executor12

    (@executor12)


    Hello!

    I am currently trying to set the wp-user-avatars on my site to be background images. I am using the following code to do so:

    <div id=”user-stream-avatar” style=”background-image: url(‘<?php echo get_wp_user_avatar_src($offline_users[$i], 1140) ?>’)”></div>

    I have used this successfully with featured images from posts, with the following code:

    <div class=”post-bg-size-big” style=”background-image: url(‘<?php echo $image[0]; ?>’)”>

    Is there something I am missing in relation to how wp-user-avatar works?

    The main place I am trying to use this code is at the following URL:

    http://dev.glitch.mn/stream

    Thank you very much for your help!
    Nic

    http://ww.wp.xz.cn/plugins/wp-user-avatar/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Nic, your divs have no dimensions and no content, so you’ll have to set a width and height. Also, per CSS rules, you can only use an ID once. I would change the id=”user-stream-avatar” to class=”user-stream-avatar”.

    Thread Starter executor12

    (@executor12)

    Worked like a charm, thank you so much for your help!

    Nic

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Set avatar as background image’ is closed to new replies.