There are 3 authors in our company blog, each author has own site url in profile settings:
Mike - http://mike.com
Gelens - http://gelens.com
Admin - http://site.com/company/
the links for profiles are:
http://site.com/author/Mike/
http://site.com/author/Gelens/
http://site.com/author/Admin/
I need to replace a link to Admin’s page, so, if there is <?php the_author_posts_link(); ?>
tag on some page, and the author is Admin, the link must be http://site.com/company/
instead of http://site.com/author/Admin/
.
How can I do that?
It looks like the
the_author_posts_link
function just callsget_author_posts_url
to get the link, which passes the link through theauthor_link
filter before returning it. In your theme’sfunctions.php
, you could add something like this (untested):I think the least heartburn would be wordpress > the_author_meta.
Have each user add their url in the wordpress user profile, as you have done. Then in your theme’s
functions.php
usethe_author_meta('user_url')
. Remember this will echo the url. To use it as a variable useget_the_author_meta('user_url')
.Here is how we did it with the twenty ten theme, this is in
functions.php
That’s URL rewriting with .htaccess, which is possible by editing the .htaccess by hand.
But easier for a beginner with a plugin such as http://wordpress.org/extend/plugins/redirection/ which seems like it will do what you need.
You can do this using http rewrites.
I also needed author URL to a different page.
My site is on WordPress and I use oxygen.
I went to my blog page template where I entered the author which is selected dynamically.
there is an option to link the author’s name to the archive page or the author’s website.
I selected the author’s website. Then went to the users on WordPress and went to the authors and added the page I wanted to actually go to as their website.