最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Co-author plus: list of posts by authors in the sidebar

programmeradmin1浏览0评论

I am using co-author plus. I would like to display all/recent posts by authors of a post in the sidebar. Is there a way of doing that? Plugins like Author Recent Posts do not work with Co-author plus.

Would be grateful for any suggestions/advice.

VR

I am using co-author plus. I would like to display all/recent posts by authors of a post in the sidebar. Is there a way of doing that? Plugins like Author Recent Posts do not work with Co-author plus.

Would be grateful for any suggestions/advice.

VR

Share Improve this question asked Jun 27, 2019 at 11:47 len71len71 101 3
  • At first glance it looks like Co-Authors plus overrides most if not all of the mechanisms for searching for posts by an author, so I'm surprised it doesn't just work. I'd start by looking at how Author Recent Posts builds up its list of other posts by the same author and then try and figure out why that's bypassing co-authors plus. Or just enhance it to explicitly make the co-author query too, if you can figure out how co-authors plus stores the extra authors. – Rup Commented Jun 27, 2019 at 12:33
  • I'm assuming you want a single listing of posts by all of the co-authors? Or do you want to separate the listings by individual authors? – Gavin Commented Jun 27, 2019 at 14:49
  • Yes, a single listing would be fine. Thanks. – len71 Commented Jun 28, 2019 at 15:08
Add a comment  | 

1 Answer 1

Reset to default 0

Not sure if you're looking for an "automated" way of doing this, but in code you can get an array of all co-authors by using $authors = get_coauthors();. Once you have your authors array, you can loop through it and use each author object's ID to get posts by that author:

$authors = get_coauthors();
foreach ( $authors as $author ) {
    $args = array( 'author' => $author->ID );
    $posts = get_posts( $args );
    // echo out your posts
}
发布评论

评论列表(0)

  1. 暂无评论