Author name not showing up (2 posts)

  1. HorrorUK
    Posted 5 years ago #

    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:


  2. tigtog
    Posted 5 years ago #

    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() ); ?>
    </div><!-- #author-link	-->

Topic Closed

This topic has been closed to new replies.

About this Topic