WordPress:如何将作者的姓名链接到该作者的帖子列表

时间:2011-01-11 13:17:30

标签: wordpress

我正在设置一个WordPress博客,我无法将作者姓名链接到该作者撰写的帖子列表。

我正在使用此代码:

written by <a href="<?php get_author_posts_url(); ?>"><?php the_author() ?></a>

但是这给了我以下错误:

Warning: Missing argument 1 for get_author_posts_url(), called in /customers/zinneket.be/zinneket.be/httpd.www/wp-content/themes/zinneket/index.php on line 15 and defined in /customers/zinneket.be/zinneket.be/httpd.www/wp-includes/author-template.php on line 220 

第15行当然是上面复制的。

有谁知道正确的方法吗?

非常感谢。

1 个答案:

答案 0 :(得分:7)

The documentation明确表示你需要提供一个论证(以确定你感兴趣的作者)。

从它的外观来看,the_author_posts_link()就是你想要使用的。

经验法则:the_函数涉及当前作者/帖子/页面/无论如何,get_函数要求您识别您感兴趣的作者/帖子/页面/页面。