WordPress.org

Ready to get started?Download WordPress

Forums

Author name not showing up (2 posts)

  1. HorrorUK
    Member
    Posted 3 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:

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

  2. tigtog
    Member
    Posted 3 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() ); ?>
    					</a>
    </div><!-- #author-link	-->

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags