Support » How-To and Troubleshooting » Author name not showing up
5 years, 2 months 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:
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:
<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">→</span>', 'twentyeleven' ), get_the_author() ); ?>
</div><!-- #author-link -->