0

I am going to create a user profile page for all users in my blog. I thought, it is better to modify the author page for all users.

<?php
if(is_author()) { 
echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'themejunkie_author_bio_avatar_size', 60 ) ); ?>
<h3><?php the_author(); ?></h3>
<?php the_author_meta( 'description' );} ?>

I use above code in archive.php file.

Ex Author Page : mysite.com/author/username

Above link is worked for only authors. How I modify that page for all users even they have not published any post ( Even role is Subscriber).

3
  • Possibly duplicate to this question Commented Jul 22, 2014 at 9:06
  • @Nilambar Thanks. :-) But, I don't want to use WordPress plugin for this. That is also very similar question. But that isn't what I ask. I want to change the author page for all users.
    – Sasa1234
    Commented Jul 22, 2014 at 13:34
  • Link to your theme/site please. You want a single user profile page or a list of all users in an archive? Commented Jul 22, 2014 at 15:00

1 Answer 1

0

To get the data of the user displayed on the current author archive page you can use:

$author = get_user_by( 'slug', get_query_var( 'author_name' ) );
$user_info = get_userdata( $author->ID );

More info on what is returned: http://codex.wordpress.org/Function_Reference/get_userdata

From there you can use the user details you need:

<?php echo $user_info->user_firstname . ' ' . $user_info->user_lastname; ?>

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.