只做利于SEO的网站,提供网站建设、SEO、网站代运营等服务。服务中心 | 建站流程 | 网站地图

Wordpress文章页the_author()调用作者失效

2021-10-18小猴建站 阅读()相关主题:wordpress

文章内容页调用的内容比较多,如果用 the_author(); 函数调用是失效的,其实这个函数只能用在文章列表的循环中,是不能使用在 single.php 的。应该用如下函数:

<?php get_the_author_meta('display_name',$post->post_author);?>

函数参数说明

user_login(用户登录名)
user_pass(用户登录密码)
user_nicename(用户昵称)
user_email(用户邮箱地址)
user_url(用户网站地址)
user_registered(用户注册时间)
user_status(用户状态)
display_name(作者显示的名称)
nickname(作者昵称)
first_name(作者名字)
last_name(作者姓氏)
description(作者描述)
user_level(用户等级)
user_firstname(用户名字)
user_lastname(用户姓氏)
user_description(用户描述)