intentionallywidenberg
Forum Replies Created
-
Forum: Plugins
In reply to: [Debug Info] No display/controlsWhere is this “Debug Info” menu item supposed to be located?
On the left hand side of the dash along with the “Pages” “Plugins” & “Settings” menu? Because it didn’t show up there.Was it supposed to be on the main data pane, perhaps hidden in the “Screen Options” pulldown? I might have not thought to look there.
Forum: Plugins
In reply to: [Co-Authors Plus] Co-Author Avatars – An educated question :)Use the optional ID argument to the get_the_author_meta() function:
$coauthors = get_coauthors(); foreach( $coauthors as $coauthor ) { $user_id = $coauthor->ID; get_avatar( get_the_author_meta( 'user_email', $user_id ) ) /// more code here }
Forum: Plugins
In reply to: [Co-Authors Plus] Multiple "About Author" Boxes.I’m using Mantra theme, and I did a search in the wp/wp-content/themes/mantra files for things like get_the_author and get_avatar.
I found 2 major instances – the code to make byline at the top of a post and the code to make the bio at the bottom.for the bio, (in single.php) I rewrote the code to take an array of authors instead of a singular one, and loop through the array.
I also added a snippet of code above it to check for coauthor plugin, and call it if present or wrap the get_the_author result with an array so it would work with my modified code.Obviously I wrapped the existing code in a loop, iterating through each coauthor to feed to the existing code.
Then I had to figure out how to get the get_the_author’s_blahblahblah() functions to get the correct info for each coauthor rather than the default author. I found that most of the functions would take an optional ID argument, so I saved it as $user_id and added it to the function calls. I think I had to replace one function with an explicit call to look up the display_name or else I got the same name repeated.<?php // Safety first. Make sure code will work if coauthors plugin is off $authornum = 0; if ( function_exists( 'get_coauthors' ) ) { $coauthors = get_coauthors(); } else { $coauthors = array(); $coauthors[] = get_the_author(); } ?> <?php foreach( $coauthors as $coauthor ) { $authornum = $authornum + 1; $user_id = $coauthor->ID; ?> <?php if ( get_the_author_meta( 'description', $user_id ) ) : // If a user has filled out their description, show a bio on their entries ?> <div id="entry-author-info"> <div id="author-avatar"> <?php echo get_avatar( get_the_author_meta( 'user_email', $user_id ), apply_filters( 'mantra_author_bio_avatar_size', 60 ) ); ?> </div><!-- #author-avatar --> <div id="author-description"> <h2><?php printf( esc_attr__( 'About %s', 'mantra' ), get_the_author_meta( 'display_name', $user_id ) ); ?></h2> <?php the_author_meta( 'description', $user_id ); ?> <div id="author-link"> <a>"> <?php printf( __( 'View all posts by ','mantra').'%s <span class="meta-nav">→</span>', get_the_author_meta('display_name', $user_id) ); ?> </a> </div><!-- #author-link --> </div><!-- #author-description --> </div><!-- #entry-author-info --> <?php endif; } ?>
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]