Co-Authors Plus
Trying to display multiple author bios with Author Bio Box and Co-Authors Plus (2 posts)

  1. Angelya
    Posted 2 years ago #

    Hi there,

    I'm trying to tweak the code of the Author Bio Box plugin to loop through multiple authors added using Co-Author Plus and display more than one bio box below each post.

    I'm rather a wp-coding newbie but my hacking thus far has lead to this section of code - it's where the html is generated for the author box itself.

    <?php $coauthors = get_coauthors(); ?>
    <?php foreach( $coauthors as $coauthor ): ?>
            $html = '<div id="author-bio-box" style="' . $styles . '">';
            $html .= '<h3><a style="color: ' . $settings['title_color'] . ';" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" title="' . esc_attr( __( 'All posts by', 'authorbiobox' ) . ' ' . get_the_author() ) .'" rel="author">' . get_the_author() . '</a></h3>';
            $html .= '<div class="bio-gravatar">' . get_avatar( get_the_author_meta('ID'), $gravatar ) . '</div>';
            foreach ( $social as $key => $value ) {
                if ( ! empty( $value ) )
                    $html .= '<a target="_blank" href="' . esc_url( $value ) . '" class="bio-icon bio-icon-' . $key . '"></a>';
            $html .= '<p class="bio-description">' . apply_filters( 'authorbiobox_author_description', get_the_author_meta( 'description') ) . '</p>';
            $html .= '</div>';
    <?php endforeach; ?>

    I'm hoping this is the right place for the co-author loop but I'm having trouble working out where I need to put $coauthor bits - I'm assuming anything with "get_" in it?

    Any help here would be much appreciated :)



  2. rob_st_82
    Posted 2 years ago #

    Hi Angelya,

    i ran into a similar issue (http://wordpress.org/support/topic/how-to-display-single-co-authors) and this is how I solved it: http://pastebin.com/GgJNcswV

    hope that helps.

    The most important thing is to wrap it in a "foreach"-fuction. The nasty thing is to acces the individual author-data like archive-URL, bio, etc. But with the code in the pastebin, you'll get an idea, how to acces and display them in the frontend.

    yeah, and the global $post; at the beginning of the function is another important thing I guess.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Co-Authors Plus
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic