• Resolved Catalan

    (@catalan)


    I apologize if this is a frequently asked question, but the only relevant threads I could find are from two years ago (I tried following instructions there, but with no result). I also apologize if the answer is obvious.

    How do I add the author’s name to posts? I’m surprised WordPress doesn’t have a built in feature of toggling this (again, I apologize if it does and I just haven’t found it).

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi Catalan,

    The author’s name is normally automatically shown for posts in Twenty Eleven (in the single post view). Are you wanting to show the author’s name somewhere else?

    Thanks!

    Do you mean add bio of author at bottom of posts if so

    try this on single.php file just before <?php comments_template() ?>).

    <div id="author-bio">
    	<h3>About The Author</h3>
    	<h4><?php the_author(); ?></h4>
           <?php the_author_description(); ?>
    </div><!--end author-bio-->

    to have it working the profile of author needs to be updated.

    Thread Starter Catalan

    (@catalan)

    Sorry, for some reason I didn’t catch that the author name is included at the bottom of the post. How would I add it on the index, in the same place?

    Thank you for the author bio. That wasn’t what I was asking for, but it was something I was also interested in including!

    Hi Catalan,

    Before making the following change, please make sure you are using a Child Theme so future updates to the theme do not overwrite your changes.

    In Twenty Eleven the style sheet contains the following, which hides the author:

    .single-author .entry-meta .by-author {
    	display: none;
    }

    To unhide the author name on the front page, in your Child Theme Style Sheet add this:

    .single-author .entry-meta .by-author {
    	display: inline;
    }

    Hope this helps!

    Thread Starter Catalan

    (@catalan)

    Thank you!

    For some reason the solution does not work on my site. I have changed the line from “display: none” to display: inline;”.
    Any idea as to why it does not work?

    Oh, sorry – it is working on single post views. However, I was looking for having the same info displayes below the headline of the posts on my frontpage (posts). Is there a solution for this?

    make sure this all happens in a child theme of Twenty Eleven – do not edit the default theme Twenty Eleven directly.
    http://codex.wordpress.org/Child_Themes

    you need to copy the relevant section from content-single.php, and enter it into content.php, into the corresponding location.

    <?php if ( get_the_author_meta( 'description' ) && ( ! function_exists( 'is_multi_author' ) || is_multi_author() ) ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries ?>
    		<div id="author-info">
    			<div id="author-avatar">
    				<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 68 ) ); ?>
    			</div><!-- #author-avatar -->
    			<div id="author-description">
    				<h2><?php printf( __( 'About %s', 'twentyeleven' ), get_the_author() ); ?></h2>
    				<?php the_author_meta( 'description' ); ?>
    				<div id="author-link">
    					<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
    						<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentyeleven' ), get_the_author() ); ?>
    					</a>
    				</div><!-- #author-link	-->
    			</div><!-- #author-description -->
    		</div><!-- #author-info -->
    		<?php endif; ?>

    Thank you very much for answering so soon. This did not work either, I am afraid. However, it looks like your code will give more info than I wanted. I just want to display the line: “Posted on date by author” in the same way as on single posts (www.gerdnilsson.com).

    (Rest assure – I am working on a child theme).

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Author Name on Twenty Eleven Theme’ is closed to new replies.