WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Co-Authors] firstname and lastnames (2 posts)

  1. massimo66
    Member
    Posted 5 years ago #

    Is there a way to obtain a list of firstnames + lastnames of authors?
    I don't know how to do that using the provided functions coauthors_firstnames and coauthors_lastnames. In other words, I need "John Smith and James Brown" rather than "John and James" or "Smith and Brown". I'm thinking of a coauthors_firstnames_lastnames() function...
    Thanks

  2. zeniph
    Member
    Posted 5 years ago #

    this is works - however if there's a simpler way someone please let me know!

    • the co-author pluggin allows multiple authors
    • the CoAuthorsIterator() allows you to step through them
    • however you still use the native the_author_firstname() & the_author_lastname() functions
    $i = new CoAuthorsIterator();
    print $i->count() == 1 ? 'Author: ' : 'Authors: ';
    $i->iterate();
    the_author_firstname();
    echo " ";
    the_author_lastname();
    while($i->iterate()){
        print $i->is_last() ? ' and ' : ', ';
        the_author_firstname();
        echo " ";
        the_author_lastname();
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags