我需要在WordPress中的single.php文件显示帖子的作者。该参考指示the_author();只在循环中起作用。显示作者姓名(WordPress的)
我一直在寻找其他的论坛并没有什么发现。
有什么想法?
谢谢。
编辑:
<div class="bar_info">
<?php echo "By: ".the_author(); ?>
<?php
foreach((get_the_category()) as $category) {
echo category->cat_name.', ';
}
?>
</div>
我不明白这一点。你仍然在'single.php'中利用循环,所以你仍然可以使用'the_author();'或'get_the_author();',etch。 – Ohgodwhy