Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Wordpress - using authors first, last, name in url for a list of posts

Posted on 2011-09-03
5
Medium Priority
?
279 Views
Last Modified: 2012-06-27
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,

Chris


0
Comment
Question by:St_Aug_Beach_Bum
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:PragmatiCoder
ID: 36481316
1. Go to your wordpress admin
2. Go to Settings->Discussion->Before a comment appears
3. Uncheck both options
0
 
LVL 5

Expert Comment

by:PragmatiCoder
ID: 36481317
Wrong question...
0
 

Author Comment

by:St_Aug_Beach_Bum
ID: 36481829
Well... barring changing it to using first name/last name,..

I could use the 'nicename', which it looks like is now called the 'nickname'?

But I'm getting something wrong or misunderstanding the direction at http://codex.wordpress.org/Author_Templates

I've change the file 'archive.php' to 'author-{nicename}.php', and then gone to the url mysite.com/author/adrian ('adrian') being the user's nickname in this case - and I get a 404 error.

I also tried changing the file to  'author-{nickname}.php' and got 404 on that as well.

I feel like I am missing something that's key to understanding how to do this... do I have to name the file using the actual nickname?
0
 
LVL 31

Accepted Solution

by:
gwkg earned 2000 total points
ID: 36582950
All the author templates do is allow you to use a different template to display specific author pages.

What you are trying to do is change the author 'slug'

Something like this may help: http://wordpress.org/extend/plugins/author-slug/
0
 

Author Closing Comment

by:St_Aug_Beach_Bum
ID: 36583585
Yep, a plugin did the trick, actually ended up using this one: http://wordpress.org/extend/plugins/edit-author-slug/

but thank you :)  Chris
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Transferring a wordpress site from a host or local dev server to another host can be a pain. So I've included my steps on how I have accomplished this task. Steps include an assumption that you have Cpanel access or Ftp access.. If you do not hav…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This video teaches users how to migrate an existing Wordpress website to a new domain.
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question