• I’m using co-authors on a site, and have no problem listing multiple authors in the header, where possible. however, I’d like to also include all authors’ biographies (profile -> description), for multiples, in the footer. Possible with this plugin? Custom snippet or shortcode I need for that?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Mihail D

    (@memberremember)

    something like this

    if ( function_exists( 'get_coauthors' ) ) {
       $coauthors = get_coauthors();
       foreach( $coauthors as $coauthor ) {
           // var_dump($coauthor)
           // ......
           // $coauthor->ID
           // $coauthor->display_name
           // $coauthor->user_email
       }
    }

    Hi,

    I found myself in the position of wanting to do the same thing: displaying all the Author names and biography (descriptions) at the bottom of the post. I’m really not good at codes so my code may not be perfect but it works (at least it does for me).

    Here’s what I’ve come up with:

    <?php if ( function_exists( 'get_coauthors' ) ) {
    
      $coauthors = get_coauthors();
      foreach ( $coauthors as $coauthor ) {
        ?>
        <div id="authorboxsingle" class="authorboxsingle">
        <p><span class="authorboxsinglename"><?php echo ( $coauthor->display_name ); ?></span> <span class="authorboxsinglelink">(<a href="<?php echo get_author_posts_url( get_the_author_meta( '$coauthor->ID' ), get_the_author_meta( '$coauthor->user_login' ) ); ?><?php echo ( $coauthor->user_login ); ?>">See all</a>)</span></p> 
        <p class="authorboxsinglebio"><?php echo ( $coauthor->user_description ); ?></p>
        </div>
        <?php
      }
    // treat author output normally
    } else {
    
      ?>
        <div class="authorboxsingle">
            <p><span class="authorboxsinglename"><?php esc_html(the_author_meta('display_name')); ?></span> <span class="authorboxsinglelink">(<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>">See all</a>)</span></p>
            <p class="authorboxsinglebio"><?php esc_textarea(the_author_meta('description')); ?></p>
        </div>
    
      <?php
    } ?>

    Styling:

    /*---Author Box in Blog Post (Blog post only)---*/
    #authorboxsingle {
    	display: none;
    }
    .single-post #authorboxsingle {
    	display: block;
    }
    .authorboxsingle {
    	background-color: #fff;
      padding: 20px;
      width: 100%;
    }
    .authorboxsinglename {
    font-size: 1.25rem;
    font-weight: bold;
    line-height: 1.4;
    }
    .authorboxsinglelink {
    font-size: 0.9rem;
    font-weight: normal;
    line-height: 1.4;
    }
    .authorboxsinglelink a {
    font-size: 0.9rem;
    font-weight: normal;
    }

    The first part needs to be pasted in single.php file of the theme you’re using where you want the bio to be displayed. The second part under Appearance > Customize > Additional CSS.

    The code displays author’s name, a link to see all the author’s posts and the bio. In case Co-Authors Plus is disabled it just shows the name, link and bio of the first author.

    In my case I only wanted the names, links and bios only to be displayed in single-posts (main blog) and not in custom posts. That’s what this bit does:

    #authorboxsingle {
    	display: none;
    }
    .single-post #authorboxsingle {
    	display: block;
    }

    I hope it works for other people too and hope I could help by sharing the code. If anyone has any improvements let me know.

    Kind regards,
    Cédric

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘possible to list all authors’ biographies in the footer’ is closed to new replies.