我正在建立一个WordPress博客,我无法将作者姓名链接到该作者撰写的帖子列表.
我正在使用此代码:
written by <a href="<?php get_author_posts_url(); ?>"><?php the_author() ?></a>
Run Code Online (Sandbox Code Playgroud)
但这给了我以下错误:
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
Run Code Online (Sandbox Code Playgroud)
第15行当然是上面复制的第15行.
有谁知道这样做的正确方法?
非常感谢.
文档清楚地表明您需要提供一个参数(以确定您感兴趣的作者).
从它的外观来看,the_author_posts_link()就是你想要使用的.
经验法则:the_函数涉及当前作者/帖子/页面/其他,get_函数要求您识别作者/帖子/页面/您感兴趣的内容.
| 归档时间: |
|
| 查看次数: |
6153 次 |
| 最近记录: |