如何在我的网站帖子页面上显示作者姓名?

问题描述:

如何在我的网站主页和单个帖子页面的日期附近显示作者姓名? 。是否有这样的CSS代码。 Iam使用海明威主题。我的网站是www.avjtrickz.com。请帮助我,感谢提前。如何在我的网站帖子页面上显示作者姓名?

你必须使用:

<?php $author = get_the_author(); ?> 

或:

<?php the_author(); ?> 

在这里你可以找到更多的信息:https://codex.wordpress.org/Function_Reference/get_the_author

在这里:https://codex.wordpress.org/Function_Reference/the_author

在这里:Show Author name in single.php (Wordpress)

+0

谢谢..它的工作 –

+0

这是伟大的。如果您标记这个答案,因为你的问题进行适当的解决我将不胜感激。 – Plenarto

+0

完成!我还有一个问题。我的网站首页显示一个警告错误消息(警告:缺少论据2在/ home/kiranjithz /的public_html /可湿性粉剂内容/主题/海明威/ functions.phpon线hemingway_custom_more_link()179)如何解决It.please帮助 –

这需要使用作者WordPress的法典来完成。该引用需要在循环中使用。这没有CSS。

https://codex.wordpress.org/Function_Reference/the_author

+0

谢谢您的帮助 –

<?php $name = get_the_author_meta('display_name'); ?> 

参考:https://developer.wordpress.org/reference/functions/get_the_author_meta/

+0

感谢您的帮助。问题解决了 –