Wordpress - using authors first, last, name in url for a list of posts
Posted on 2011-09-03
I would like to have links on my site that will go to a page that displays all of a users posts.
I have not used it in the past, but it looks like wordpress does it easily enough, apparently using the 'archive.php' page in my theme.
So I can have a url like this: www.mysite.com/author/username and it will display their posts very nicely.
Here's the problem I am dealing with though... in the past, some of my users choose different usernames than the names they write under. When writing, we list their first & last name as the 'author'.
So if I go with the way things are set up write now - the url might be www.mysite.com/author/andy (the username being the author's real first name) when the "author's name" on the post is Jacob Long. It makes it look a bit goofy.
Is there a way I can set wordpress up to use a url like this: www.mysite.com/author/firstName-lastname to list the posts from that author?
Setting up the links is easy enough using:
$user->user_firstname . '-' . $user->user_lastname
in the url. But of course, that link does not work unless they happened to use their full name as their user name.
I'm not even sure if I would tackle this issue in the .htaccess, index.php, header.php, archive.php, or some wordpress file?
Thanks for any help on this,