WordPress.org

Ready to get started?Download WordPress

Forums

Making author name appear in posts (5 posts)

  1. margowin
    Member
    Posted 1 year ago #

    I can't find a way to do this and manage a couple blogs. I keep finding answers that are years old saying "comment back in the author name in the template code" but I after hours of searching I have no idea how to access that. Making blog author name appear on blog posts shouldn't be THIS hard!!!!

  2. PinkishHue
    Member
    Posted 1 year ago #

    In most themes, the author name appears below the post. What theme are you using?

    To include it in the page that displays just the post, you need to add some code to the file in your theme that displays single posts, usually single.php or in newer themes something like content-single.php. Here is more information on the code you need to add:

    http://codex.wordpress.org/Function_Reference/the_author

    Something like this: '<p>This post was written by <?php the_author(); ?></p>'

    If you let us know what theme you are using it will be easier to give advice.

    Good luck,
    Jo

  3. margowin
    Member
    Posted 1 year ago #

    Hi Jo. Thanks for the response. I have looked and looked and have not found where the templates are for me to update the code. I'm using plain ole Twenty Twelve. Any suggestions on how to find the template?

    Thanks!

  4. PinkishHue
    Member
    Posted 1 year ago #

    Sorry for delayed reply.

    You want to open content.php
    (*important - see note below re: child themes)

    Around line 38, find this:

    <div class="entry-content">
    			<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?>

    and under that, add this:

    <?php if ( is_single() ) : ?>
    			<p>This post was written by <?php the_author(); ?></p>
    			<?php endif; // is_single() ?>

    ---------------

    * (you really should use a child theme if you're not. To do that simply add a new folder called mychildtheme (or whatever you prefer) in your themes folder at: yourwebsite.com/wp-content/themes

    Add a style.css file that contains this:

    /*
    Theme Name:     My Child Theme
    Description:    Child theme for the Twenty Twelve theme
    Author:         Your name here
    Author URI:     http://example.com/about/
    Template:       twentytwelve
    Version:        0.1.0
    */
    
    @import url("../twentytwelve/style.css");

    then add the edited content.php file in to that folder

    (Then activate the child theme in your admin panel)

  5. alchymyth
    Forum Moderator
    Posted 1 year ago #

    it is one of the 'tricks' in Twenty Twelve too hide the author if there is only one othor in the site;

    (done by an added body_class and css)

    to show the info, add this to style.css of a child theme or to a custom css plugin:

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags