Reputation: 427
I am creating a WordPress plugin which lists the author and its contributors in custom post meta-box. So what happens so far is when a user clicks the author name, it gives authors archive page which lists all the posts by author. So how can I list that same post in contributor's archive page?
Upvotes: 0
Views: 241
Reputation: 149
What you are asking for is a meta_query
.
I am assuming on contributor archive page you can able to get contributor ID.
Now suppose you store your post meta like meta_key = 'contributor_id'; and meta_value = '2' //ID of contributor
So now
$args = array(
'meta_query' => array(
array(
'key' => 'contributor_id',
'value' => '2',
'compare' => '=',
)
)
);
$query = new WP_Query($args);
print_r($query);
above code will return all the posts which belongs to that specific contributor.
Upvotes: 1
Reputation: 31
I don't think this is possible automatically. On WordPress every post has one and only author, so in the archive page of that author you'll have only his/her posts.
Maybe you could implement a widget/plugin to show "related posts"
Upvotes: 0