josbos
josbos

Reputation: 3

WordPress: How to link the name of an author to that author's list of posts

I'm setting up a WordPress blog and I can't manage to link an author's name to the list of posts written by that author.

I am using this code:

written by <a href="<?php get_author_posts_url(); ?>"><?php the_author() ?></a>

But this gives me following error:

Warning: Missing argument 1 for get_author_posts_url(), called in /customers/zinneket.be/zinneket.be/httpd.www/wp-content/themes/zinneket/index.php on line 15 and defined in /customers/zinneket.be/zinneket.be/httpd.www/wp-includes/author-template.php on line 220 

Line 15 is of course the one copied above.

Does anyone know the right way to do this?

Thanks a lot.

Upvotes: 0

Views: 6417

Answers (1)

Victor Nicollet
Victor Nicollet

Reputation: 24577

The documentation makes it fairly clear that you need to provide an argument (to identify what author you're interested in).

From the looks of it, the_author_posts_link() is what you want to use.

Rule of thumb: the_ functions involve the current author/post/page/whatever, get_ functions require you to identify what author/post/page/whatever you are interested in.

Upvotes: 7

Related Questions