display\\u name应该写什么?我想在自定义帖子类型中显示作者名称,但我为get\\u the\\u author()函数获取了管理员名称“root”,当我使用get\\u the\\u auther\\u meta()时,我无法获取任何内容。如果有人知道,请告诉我。
如何在自定义帖子类型中显示作者姓名
1 个回复
SO网友:vishal
我犯的错误是,我忘记了获取author框,因此\\u author函数不起作用,所以我在函数中添加了此代码。php文件
add_post_type_support( \'my_post_type\', array(
\'author\', \'excerpt\',
) );
然后我得到了author框,在author框中,设置author name并在自定义post文件中添加此代码 the_author();
或 echo get_the_author_meta(\'display_name\');