2016-02-10 25 views
2

不知道爲什麼我沒有得到我傳遞的大小,即260.我知道的限制是512,但我仍然得到96大小的頭像而不是260這是這裏的情況。get_avatar_url(get_avatar())總是返回默認的96尺寸?

我的代碼:

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

回答

2

明白了!當我將它提供給get_avatar()時,我不得不向get_avatar_url()提供數組參數。

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

我想你只需要get_avatar_url$curauth->ID。它看起來像在函數內使用get_avatar兩次呼叫頭像。大小arg的數組是正確的。

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