Display a default bio for all members? (3 posts)

  1. fabtigger
    Posted 4 years ago #

    I would like display a default bio for all members which will be overidden when a user adds info to their bio box. I searched the forums and plugins and couldn't find anything.

    I'm using a twenty eleven child theme. If that helps

  2. Michael
    Forum Moderator
    Posted 4 years ago #

    you will possibly need to edit content-single.php and author.php (i.e. copy these templates into your child theme and edit them there);

    in content-single.php, find the section starting with this line:

    <?php if ( get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries ?>

    and ending with:

    </div><!-- #entry-author-info -->
    		<?php endif; ?>

    before the <?php endif; ?> add a 'else' section where you copy all the html tags, but with default content;

    <?php else : ?>
    whatever default bio you want to show

    (use/replicate the existing html tags/structure for the default bio)

    similar in author.php; the section starts with:

    				// If a user has filled out their description, show a bio on their entries.
    				if ( get_the_author_meta( 'description' ) ) : ?>

    and ends in:

    </div><!-- #entry-author-info -->
    				<?php endif; ?>

    again, add the 'else' code with the default bio before the 'endif' line.

  3. fabtigger
    Posted 4 years ago #

    Thanks alchymyth, that looks like it would work. Annoyingly I'm using an authorbox plugin on my pages, so this method wont work for me. I think I was hoping for a fix that effected the function for calling the bio wordpress, not just on a template level. But this is my fault for not listing all of my info, sorry (it still might work in the authorbox plugin somewhere)

    I'm using authorbox reloaded plugin "get_the_author_meta( 'description'" is used to call the description still. Heres a snippet of the code...

    public function authorbox_display() {
    		global $author;
    		$author_name = get_the_author_meta( 'display_name', $author );
    		$author_photo = get_avatar( get_the_author_meta( 'user_email', $author ), '100', '', $author_name );
    		$author_photo = str_replace( '<img ', '<img id="authorbox-photo" title="'.$author_name.'" ', $author_photo );
    		$box  = '	<div id="authorbox">'
    					.'		<div class="clear">'
    					.'			<p>' . $author_photo
    					.'			<strong>' . str_replace( " ", "-", $author_name ) . ': MORE ABOUT THE AUTHOR</strong><br>' . get_the_author_meta( 'description', $author ) . '<br><strong><a href="'.get_bloginfo('wpurl').'/author/' . str_replace( " ", "-", $author_name ) . '">View all entries by ' . str_replace( " ", "-", $author_name ) . ' ></a></strong></p>'
    					.'		</div>';

Topic Closed

This topic has been closed to new replies.

About this Topic