如何给出一个“div类”的回声?

时间:2016-09-27 16:44:42

标签: php css wordpress echo

尝试在我的回声中添加一个css类来设计这个样式,我尝试了一些变化,但它没有用。

这是我正在使用的当前代码行:

<?php echo get_avatar( get_the_author_meta( 'ID' ) , 32 ); ?>

1 个答案:

答案 0 :(得分:1)

get_avatar的最后一个参数是一个包含各种选项的数组,包括附加一个类的能力。

echo get_avatar( get_the_author_meta( 'ID' ) , 32, '', '', array("class"=>"your class"));

有关详细信息,请参阅https://developer.wordpress.org/reference/functions/get_avatar/

另一方面,如果您只想将现有输出包装在div中,那么您只需要将其包装在div标签即ie中。 echo "<div class='bla'>".get_avatar( get_the_author_meta( 'ID' ) , 32)."</div>";