Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress get_avatar_url(get_avatar())是否始终返回默认大小?_Wordpress - Fatal编程技术网

Wordpress get_avatar_url(get_avatar())是否始终返回默认大小?

Wordpress get_avatar_url(get_avatar())是否始终返回默认大小?,wordpress,Wordpress,不知道为什么我没有得到我通过的尺寸,即260。我知道限制是512,但我还是得到了96个大小的头像,而不是这里的260个 我的代码: <?php $avatar_url = get_avatar_url(get_avatar( $curauth->ID, 260 )); ?> <div class="author-thumbnail" style="background-image: url('<?php echo $avatar_url; ?>');">

不知道为什么我没有得到我通过的尺寸,即260。我知道限制是512,但我还是得到了96个大小的头像,而不是这里的260个

我的代码:

<?php $avatar_url = get_avatar_url(get_avatar( $curauth->ID, 260 )); ?>
<div class="author-thumbnail" style="background-image: url('<?php echo $avatar_url; ?>');"></div>


明白了!我必须给出数组参数才能获取_avatar_url(),而我要给出数组参数才能获取_avatar()



我想你只需要
获取头像\u url
$curauth->ID
。通过在函数中使用
get\u avatar
,您似乎正在两次调用虚拟形象。大小参数的数组是正确的

<?php $avatar_url = get_avatar_url($curauth->ID, array("size"=>260)); ?>
<div class="author-thumbnail" style="background-image: url('<?php echo $avatar_url; ?>');"></div>

<?php $avatar_url = get_avatar_url($curauth->ID, array("size"=>260)); ?>
<div class="author-thumbnail" style="background-image: url('<?php echo $avatar_url; ?>');"></div>