Had kind of a hard time trying to find documentation for how to implement coauthor plus in single.php or sidebar.php, so I wanted to share the code I used for p3.no/filmpolitiet
(remove the debug part when you’re finished testing).
Test: https://pappmaskin.no/2013/01/test-coauthors-plus/?debug=1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | <!-- start coathors kode --> <?php $debug = 0; $debug = $_GET["debug"]; if (function_exists('get_coauthors') && $debug ==1) { echo "Sorry for the mess, site under construction"; $coauthors = get_coauthors(); // $post_id ? ?> <?php foreach( $coauthors as $coauthor ) : ?> <?php $profilbilde = "";?> <div class="author-wrap"> <div class="b_metaboks"> <div class="b_skribent"> <a href="<?php echo site_url(); ?>/author/<?php echo $coauthor->user_login; ?>" title="Les artiklene til <?php echo $coauthor->display_name; ?>"><?php echo $coauthor->display_name; ?></a></div> <div class="b_epost"><a href="mailto:<?php echo $coauthor->user_email; ?>"><?php echo $coauthor->user_email; ?></a></div> </div> <div class="b_bilde"> <a href="<?php echo site_url(); ?>/author/<?php echo $coauthor->user_login; ?>" title=""> <?php if($coauthor->profilbilde != "") { ?> <img alt="" src="<?php echo $coauthor->profilbilde; ?> " class="avatar avatar-100 photo" height="100" width="100"></a> <?php } //end if coauthor profilbilde else { echo get_avatar($coauthor->user_email, $size = '100', $default = '' ); //echo get_avatar(get_the_author_meta('user_email') , $size = '100', $default = '' ); } //end else coauthor profilbilde ?> </div> <div style="clear:both;"></div> </div> <!-- avslutt .author-wrap --> <?php endforeach; //coauthors?> <?php } //end check function exists get coauthors ?> <!-- end coathors kode --> |