WordPress.org

Support

Support » How-To and Troubleshooting » Author name not showing up

Author name not showing up

  • For some reason, when I add the code to show the author that wrote a post, the name isn’t showing up.

    I’m using the code in the codex example, but it doesn’t show.

    This is the code I’m using:

    <i>Added by <?php the_author(); ?> on <?php the_time('l, jS F Y'); ?></i>

    If you take a look at this post, you’ll see that it does everything, except show the author’s name:

    http://homes.inhampshire.com/?rental=test

Viewing 1 replies (of 1 total)
  • tigtog

    @tigtoggmailcom

    Fairly sure that you need to use get_the_author and some variants instead.

    Here’s how Twenty Eleven creates the author link on single.php – you should modify the following to suit your purposes:

    <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	-->
Viewing 1 replies (of 1 total)
  • The topic ‘Author name not showing up’ is closed to new replies.