WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Co-Authors Plus] Unable to bring up posts for co-author in a post array (2 posts)

  1. aplussideas
    Member
    Posted 2 years ago #

    Hi!

    Thank you for an awesome plug-in. I've been able to set it up to display co-authors information in the post meta area of my posts, and also to have co-authored posts come up in co-authors' archive pages.

    However, I'm having trouble bringing up posts for a co-author in a custom array that's part of my theme, when the author is NOT the primary/first author for the posts...

    This is my code:

    $post_args = array('posts_per_page' => 4, 'author' => $author->ID, 'post_type' => $post_type_array, 'suppress_filters' => 0);
    $slides = get_posts( $post_args );

    Seems to me that this code brings up the posts based on the primary author's ID, but since co-authors plus stores the co-authors in a taxonomy, not sure how to bring that up.

    I'm not a php expert... any help will be greatly appreciated.

    Thanks!

  2. Daniel Bachhuber
    Hand Built
    Posted 2 years ago #

    Seems to me that this code brings up the posts based on the primary author's ID, but since co-authors plus stores the co-authors in a taxonomy, not sure how to bring that up.

    Yep, this is correct. You'll probably want to use a WP_Query taxonomy query instead, where 'author' is the taxonomy, the field is 'slug', and the value will be the author's user_login.

Topic Closed

This topic has been closed to new replies.

About this Topic