<div class="kkk" style="background-image:url('<?php echo get_avatar_url(); ?>')"></div>
I want to make to appear my avatar as a backround image in this code, but it doesn't work. What is the problem?
<div class="kkk" style="background-image:url('<?php echo get_avatar_url(); ?>')"></div>
I want to make to appear my avatar as a backround image in this code, but it doesn't work. What is the problem?
It’s hard to say exactly what the problem is with your code, but...
There is at least one major flaw - you don’t pass any param to get_avatar_url
, but first param for that function is required and should contain ID or email. To be precise:
$id_or_email (mixed) (Required) The Gravatar to retrieve a URL for. Accepts a user_id, gravatar md5 hash, user email, WP_User object, WP_Post object, or WP_Comment object.