创建一个名为author的文件。php并将下面的代码放在其中。将该文件保存在主题文件夹中。主题文件夹位于您的站点上。com/wp内容/主题/主题名
<?php include_once(\'header.php\'); ?>
<div id="container">
<div class="content">
<?php
$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>
<ul>
<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>
</ul>
</div>
<?php if ( have_posts() ) ?>
<h2>Posts by: <?php echo $curauth->nickname; ?></h2>
<ul>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li>
<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(\'&\');?>
</li>
<?php endwhile; else: ?>
<h2><?php _e(\'No posts by this user.\'); ?></h2>
<?php endif; ?>
</ul>
<?php
$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>";
}
?>
</div>
</div>
<?php include_once(\'footer.php\'); ?>