Do you want to display related posts by same author in WordPress? Normally, you can use any 相关帖子插件 to show similar articles on your website. However if you run a multi-author WordPress website, then your users may want to read other content from the same author. In this article, we will show you how to display related posts by same author in WordPress.
您是否要在WordPress中显示同一作者的相关文章? 通常,您可以使用任何相关帖子插件在您的网站上显示类似的文章。 但是,如果您运行一个多作者WordPress网站,则您的用户可能希望阅读同一作者的其他内容。 在本文中,我们将向您展示如何在WordPress中显示同一作者的相关文章。

方法1:使用插件在WordPress中显示作者的相关帖子 (Method 1: Display Related Posts by Author in WordPress Using Plugin)
此方法更简单,建议所有用户使用。
此方法比较简单,推荐所有用户使用。
First thing you need to do is install and activate the 类似的帖子 plugin. For more details, see our step by step guide on 如何安装 WordPress 插件.
您需要做的第一件事是安装并激活类似的帖子插件。 有关更多详细信息,请参阅有关如何安装 WordPress 插件步指南。
Upon activation, you need to visit 设置 » 类似帖子 page to configure plugin settings.
激活后,您需要访问设置 » 类似帖子页面来配置插件设置。

设置页面分为不同的选项卡,默认情况下您将进入“常规”选项卡。您可以查看选项并更改它们以满足您的要求。
设置页面分为多个选项卡,默认情况下您将位于“常规”选项卡中。您可以查看选项并进行更改以满足您的要求。
在此页面上,您需要向下滚动到底部并选择“匹配当前帖子的作者”选项旁边的“是”。您可以取消选中其他匹配选项,以确保该插件仅按作者获取帖子。
在此页面上,您需要向下滚动到底部并选择“匹配当前帖子的作者”选项旁边的“是”。您可以取消选中其他匹配选项,以确保该插件仅按作者提取帖子。

接下来,您需要切换到“放置”选项卡并激活“发布后输出”选项。您还可以通过编辑“参数”框中的文本来编辑输出模板。
接下来,您需要切换到“展示位置”选项卡并激活“发布后输出”选项。您还可以通过编辑“参数”框中的文本来编辑输出模板。

不要忘记单击“保存设置”按钮来存储您的更改。
不要忘记单击“保存设置”按钮来存储您的更改。
您现在可以访问网站上的任何单个帖子,并且您将在帖子内容后看到同一作者的相关帖子。
现在您可以访问网站上的任何单个帖子,并且按照帖子内容您将看到同一作者的相关帖子。

方法2:在WordPress中由同一作者手动显示相关帖子 (Method 2: Manually Display Related Posts by Same Author in WordPress)
This method requires you to add code to your WordPress theme files. If you haven’t done this before, then check out our guide on 如何在 WordPress 中复制和粘贴代码.
此方法要求您将代码添加到WordPress主题文件中。 如果您以前没有做过,请查看有关如何在 WordPress 中复制和粘贴代码指南。
You will need to add the following code to your theme’s 函数.php file or in a 特定于站点的插件.
您将需要在主题的函数.php文件或具体的于在网站的插件中添加以下代码。
function wpb_related_author_posts($content) {
if ( is_single() ) {
global $authordata, $post;
$content .= '<h4>Similar Posts by The Author:</h4> ';
$authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 5 ) );
$content .= '<ul>';
foreach ( $authors_posts as $authors_post ) {
$content .= '<li><a href="' . get_permalink( $authors_post->ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '</a></li>';
}
$content .= '</ul>';
return $content;
}
else {
return $content;
}
}
add_filter('the_content','wpb_related_author_posts');
您现在可以访问网站上的任何单个帖子,并且您会在内容下方看到同一作者的相关帖子。
现在,您可以访问网站上的任何单个帖子,并在内容下方查看同一作者的相关帖子。

We hope this article helped you learn how to easily display related posts by same author in WordPress. You may also want to see our ultimate list of the 最想要的 WordPress 提示、技巧和技巧 for beginners.
我们希望本文能帮助您学习如何轻松地在WordPress中显示同一作者的相关文章。 您可能还希望查看针对初学者最受欢迎的 WordPress 提示、技巧和技巧最终列表。
If you liked this article, then please subscribe to our YouTube 频道 for WordPress video tutorials. You can also find us on 推特 and Facebook.
如果您喜欢这篇文章,请订阅我们的YouTube 频道 WordPress视频教程。 您也可以在推特和Facebook上找到我们。
翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-display-lated-posts-by-same-author-in-wordpress/