Typecho Wiki
每一个作品都值得被记录

Typecho 调用作者信息并显示头像

Typecho维基君Typecho教程 • 4573次浏览 • 发布 2018-05-18 • 更新 2018-05-18
极致加速的V2Ray 助您畅享全球网络 & 搬瓦工VPS最新优惠码
🛜自用大流量超低月租手机卡推荐榜单 #拒绝流量焦虑

今天在博客里放了一个关于作者部分,需要调用typecho中的作者信息和作者的头像。找了一下,使用如下的代码实现:

<div class="author">
<div style="float:left;margin-right:10px;">
<?php $this->author->gravatar(60); ?>
</div>
<p>本文作者:<a href="<?php $this->author->permalink(); ?>" target="_blank"><?php $this->author() ?></a>,95后,爱折腾,欢迎联系、交流。QQ:1989473781<a href="https://www.typecho.wiki">多思多金</a></p>
</div>

其中 $this->author->gravatar(60) 代码中,传入60,表示生成60*60大小的头像。

另外还有很多其他可能用到的调用:

作者信息

<?php $this->author() ?>  //作者名称
<?php $this->author->permalink(); ?>  //作者文章列表连接
<?php $this->author->url(); ?>
<?php $this->author('url'); ?>  //作者主页
<?php $this->author->mail(); ?>
<?php $this->author('mail'); ?>  //作者邮箱
<?php $this->author->gravatar(); ?>  //作者头像

分类信息

<?php echo $this->category; ?>  //分类缩略名
<?php $this->category(); ?>  //带连接的分类名称
<?php $this->category(',', false); ?>  //不带连接的分类名称

评论者信息

<?php $comments->author(); ?>  //带连接的作者名
<?php $comments->author('', false); ?>  //不带连接的作者名

广告声明:文内含有的对外跳转链接(包括不限于超链接、二维码、口令等形式),用于传递更多信息,节省甄选时间,结果仅供参考,Typecho.Wiki所有文章均包含本声明。
本文检索关键词:Typecho教程
厂商投放

【腾讯云】🎉五一云上盛惠!云服务器99元/月续费同价!

腾讯云五一劳动节海量产品 · 轻松上云!云服务器首年1.8折起,买1年送3个月!超值优惠,性能稳定,让您的云端之旅更加畅享。快来腾讯云选购吧!

广告
添加新评论 »