Press "Enter" to skip to content

在WordPress文章顶部添加作者头像以及简介

如本文上部所示效果,不错。个人感觉良好,需要添加适当的代码到相应位置。
在样式文件中添加如下代码:

#article-author { margin-top: 15px; margin-bottom: 5px; margin-top: 1px; border: 1px solid #d9d9d9; clear: both; background-color: #eee; padding: 10px; width: 635px; height: 100px; }
#author-image { height: 80px; width: 80px; border: 1px solid #d9d9d9; background-color: #FFFFFF; padding: 10px; margin-bottom: 8px; float: left; }
#author-text { float: left; margin-left: 20px; width: 500px; font-size:25px; }

在想要出现头像及作者简介的位置添加如下代码:

<div id=”article-author”>
<div id=”author-image”>
<?php if (function_exists(‘get_avatar’))
{ echo get_avatar( get_the_author_email(), ’80’ ); }?>
</div> <div id=”author-text”>
<strong>本文作者: <?php the_author_link(); ?></strong>
<p><?php the_author_description();?></p>
</div>
</div>

6 Comments

    • ronbin
      ronbin 2011年1月3日

      single那个文件里面。

  1. 3W网志
    3W网志 2011年7月12日

    测试了一下,很不错,感谢分享!

  2. 匿名
    匿名 2013年12月6日

    不错不错,下次也弄来玩玩。顺便问一下,你这网站用的主题叫什么?还有右边那个“返回顶部”和“转到底部”是怎么添加的?谢谢啊,我是搜:wordpress返回顶部找到你网站的。

    • ronbin
      ronbin 2013年12月6日

      主题你点击博客地步的 Theme by Robin 就可以找到了。。。

  3. 匿名
    匿名 2014年8月3日

    看不见效果

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注