0

I want to make a custom profile page.

So I would set a link from posts page using a simple hook, get the author, then a something like

     <a href="www.website.com/profile/<?php the_author(id); ?></a>

But how do I then retrieve this id from url for a profile page?

Get_var? or Get_object?

I would then want to display the users name, address, and other posts (custom post type) by the author.

Thank you

1 Answer 1

0

Wordpress already has a url structure for Author information. If you have pretty Permalinks enabled, the URL should read like http://www.website.com/author/username .

You can make a new template file named author.php in your theme to manipulate what is shown on this page (add meta information and whatnot).

You can get the author id in the author.php by using get_queried_object_id() . Bonus: all the posts by this author are in the loop.

To get the URL for the authors page, you can use get_author_posts_url( $author_id) .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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