Php Wordpress-获取作者图像

Php Wordpress-获取作者图像,php,wordpress,Php,Wordpress,(变量使用获取作者id())您需要为“id\u或电子邮件”添加一个参数以获取适当的化身。对于WordPress 2.7或更低版本,您可以使用get_the_author_id()。对于 WordPress 2.8及以上版本,您可以使用get_the_author_meta('ID')。该函数返回字符串或假布尔值。您可以比较返回的值以确定是否有任何化身。- “alt=”“> 自16世纪以来,Lorem Ipsum一直是行业标准的虚拟文本,当时一家不知名的印刷商拿起一个打印盘,将其拼凑成一本字体

(变量使用
获取作者id()

您需要为“id\u或电子邮件”添加一个参数以获取适当的化身。对于WordPress 2.7或更低版本,您可以使用get_the_author_id()。对于 WordPress 2.8及以上版本,您可以使用get_the_author_meta('ID')。该函数返回字符串或假布尔值。您可以比较返回的值以确定是否有任何化身。-


“alt=”“> 自16世纪以来,Lorem Ipsum一直是行业标准的虚拟文本,当时一家不知名的印刷商拿起一个打印盘,将其拼凑成一本字体样本书。它不仅存活了五个世纪,而且还跨越到电子排版,基本上保持不变。它在20世纪60年代随着Le的发行而流行traset表包含


谢谢,但我尝试过:echo get_avatar($authord,100);变量使用get_the_author_id(),你知道为什么上面的方法不起作用吗?我应该提到的是,id返回2这对我起作用了,而其他方法都不起作用了:-)我已经在问题中添加了一个更新:get_avatar()返回了什么字符串?该死的,我明白了:警告:get_avatar()缺少参数1,在第68行的F:\xampp\htdocs\vallum\wp content\themes\vallum\single.php中调用,在第2266行的F:\xampp\htdocs\vallum\wp includes\pluggable.php中定义,从get_the_author_id()返回的是什么?数字2。似乎返回了正确的东西。只是重复这个get_avatar()给出了上面的警告BTWAHH我把它放在src=”“而不是它自己
<?php while ( have_posts() ) : the_post(); ?>
    <section class="panel panel-white">
        <div class="row single-post-content">
            <?php if ($category_name !== 'Jobs') { ?>
                <h5 class="author-post__title"><?php the_author() ?></h5>
                <p><?php echo get_the_date(); ?></p>
            <?php }

            the_content();

            if ($category_name !== 'Jobs') { ?>
                <div class="row author-post">
                    <div class="small-12 medium-4 column">
                        <img src="<?php  echo get_avatar(); ?>" alt="" />
                    </div>
                    <div class="small-12 medium-8 column">
                        <h5 class="author-post__title"><?php the_author() ?></h5>
                        <p>
                            Lorem Ipsum has been the industry's standard dummy text
                            ever since the 1500s, when an unknown printer took a
                            galley of type and scrambled it to make a type specimen
                            book. It has survived not only five centuries, but
                            also the leap into electronic typesetting, remaining
                            essentially unchanged. It was popularised in the 1960s
                            with the release of Letraset sheets containing.
                        </p>
                    </div>
                </div>
            <?php } ?>
        </div>
    </section>
<?php endwhile;?>
echo get_avatar($authorId, 100); 
<?php echo get_avatar( $id_or_email, $size, $default, $alt, $args ); ?> 
<?php echo get_avatar( get_the_author_meta( 'ID' ), 32 ); ?>
<?php while(have_posts()): ?>
    <?php the_post(); ?>
    <section class="panel panel-white">
        <div class="row single-post-content">
            <?php if($category_name !== 'Jobs'): ?>
                <h5 class="author-post__title">
                    <?php the_author() ?>
                </h5>
                <p><?php echo get_the_date(); ?></p>

                <?php the_content(); ?>

                <div class="row author-post">
                    <div class="small-12 medium-4 column">
                        <?php if($avatar = get_avatar(get_the_author_meta('ID')) !== FALSE): ?>
                            <img src="<?php echo $avatar; ?>" alt="">
                        <?php else: ?>
                            <img src="/images/no-image-default.jpg">
                        <?php endif; ?>
                    </div>
                    <div class="small-12 medium-8 column">
                        <h5 class="author-post__title"><?php the_author() ?></h5>
                        <p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing.</p>
                    </div>
                </div>
            <?php else: ?>
                <?php the_content(); ?>
            <?php endif; ?>
        </div>
    </section>
<?php endwhile; ?>