0

I'm trying to figure out if there is anyway to set a static page as a person's user profile, instead of the current set up with posts and what not.

I want to be able to set a static page as the "user profile" which is accessed when clicked on the author name. Does anyone know how to do this?

The static pages need to be unique for each author.

0

You will just need to put your static html that you intend to use into the author.php template file.

It's that easy.Hope it work for you :)

| improve this answer | |
  • Thanks Ning, however each page will be a unique static page. Any ideas? – Jess Lowis Feb 10 '17 at 15:39
  • that's not possible with pure html.You will need some php to make that happen. – 吉 宁 Feb 10 '17 at 15:42
  • Is there anyway, if I only say have 5 users, and want 5 static pages for them I can force the unique pages all via HTML? Or can I only do it one as the overall template? – Jess Lowis Feb 10 '17 at 15:43
  • yes ,you can do that ,you can build up 5 author.php files and name them like author-ID.php.The ID is the author id that the file is intended for. – 吉 宁 Feb 10 '17 at 15:45
0

I believe you are trying to change the default author page to something else. Try this.

// Author page
add_action( 'template_redirect', array( $this, 'wpse_255965_template_redirect' ), 10, 1 );
function wpse_255965_template_redirect() {
    if ( is_author() ) {
        wp_safe_redirect( $location, $status );
        exit;
    }
}

// Author link
add_filter( 'author_link', array( $this, 'wpse_255965_author_link' ), 10, 1 );
function wpse_255965_author_link() {
    return home_url();
}

First function redirects author pages to something else (that's up to you). Please look at wp_safe_redirect for documentation.

Second function changes the author link to the homepage (home_url). Again, that is up to you to change it to what you like.

| improve this answer | |
  • J1, thanks for this. I can't find my author page in the editor section under appearance. No Author PHP file? – Jess Lowis Feb 10 '17 at 15:58
0

There are multiple ways this can be accomplished.
- [For Developers] Refer to Author Template Sample File and modify it as per your needs. However, use a child theme and modify a copy of parent theme's author.php
- [For new users/bloggers] Use a Custom WordPress Plugin such as User Profile.

Hope that helps.

| improve this answer | |
  • I'm guessing that the Author template is not a default file? – Jess Lowis Feb 10 '17 at 16:07
  • It's usually available in most of the themes and is present in inbuilt themes as well. The sample file will output some basic information about the user and list posts by them if any. Author template is the default file used when someone visits the author url (i.e. the profile page). Unless your theme overrides it. – devkabiir Feb 10 '17 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.