[Plugin: Co-Authors Plus] individual author id (3 posts)

  1. ankitshekhawat
    Posted 6 years ago #

    i am using the the_author() tag under the iterate loop.
    which returns me to the name of the author.

    is there a tag that i could use to get the author's user id.

    I am using buddypress and want the coauthors to be linked to the buddy press member page and not the author post archive-

    here is what i have got for now -

    $i = new CoAuthorsIterator();
    print $i->count() == 1 ? 'Author: ' : 'Authors: ';
    $i->iterate(); ?>
        <a href="http://intranet.nfshost.com/members/<?php the_author(); ?>"><?php the_author(); ?></a>
        print $i->is_last() ? ' and ' : ', '; ?>
        <a href="http://intranet.nfshost.com/members/<?php the_author();  ?>"><?php the_author(); ?></a>

    Please help

  2. @mercime
    Volunteer Moderator
    Posted 6 years ago #

  3. Mohammad Jangda
    Posted 6 years ago #

    If you're on 2.8+, you could try using the_author_meta instead of the_author().

    Alternatively (though not recommended), you could try the following:

    global $authordata;
    echo $authordata->ID;

Topic Closed

This topic has been closed to new replies.

About this Topic