in my web site I have some authors. I would that clicking on authors name, a page is opened with his contact details. How can I do?

Thanks a lot

  • 2
    Michele, It is expected that you show an effort of looking up code and checking the codex before asking a question. You are also expected to show example of code you have tried yourself. But, as I answered a similar question yesterday look at my answer below.
    – Vigs
    Jul 18, 2013 at 13:57

1 Answer 1


Create a file called author.php and place the code below in it. Save that file in your themes folder. The themes folder is located at yoursite.com/wp-content/themes/themename

<?php include_once('header.php'); ?>
<div id="container">
<div class="content">
        $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); 
        <div id="author-contact-info">
        <h2>Information about: <?php echo $curauth->nickname; ?></h2>
        <li>First Name: <?php echo $curauth->user_firstname; ?></li>
        <li>Last Name: <?php echo $curauth->user_lastname; ?></li>
        <li>Email: <?php echo $curauth->user_email; ?></li>
        <li>Website: <?php echo $curauth->user_url; ?></li>
        <li>Description: <?php echo $curauth->user_description; ?></li>   
        <?php if ( have_posts() ) ?>
        <h2>Posts by: <?php echo $curauth->nickname; ?></h2>
            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
                    <?php the_title(); ?></a>,
                    <?php the_time('d M Y'); ?> in <?php the_category('&');?>
            <?php endwhile; else: ?>
                <h2><?php _e('No posts by this user.'); ?></h2>
            <?php endif; ?>
        $args = array(
            'user_id' => $curauth->ID,
            'number' => 10, // how many comments to retrieve
            'status' => 'approve'

        $comments = get_comments( $args );

        if ( $comments )
        echo '<h2>Comments by: '.$curauth->nickname.'</h2>'; 
            $output.= "<ul>";
            foreach ( $comments as $c )
            $output.= '<li>';
            $output.= '<a href="'.get_comment_link( $c->comment_ID ).'">';
            $output.= get_the_title($c->comment_post_ID);
            $output.= '</a>';
            $output.= "</li>\n";
            $output.= '</ul>';

            echo $output;
        } else { 
            echo "<h2>This user has no comments.</h2>";
<?php include_once('footer.php'); ?>

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.