Wordpress自定义用户显示页面

时间:2014-07-14 21:49:12

标签: wordpress

首先,我想在今天早上工作的页面开始这一点,我打开页面,然后回到用户的信息,而不是显示

此页面是自定义书面作者显示页面。任何人都是该网站的贡献者在这里列出了生物,Avitar和昵称,有人可以告诉我我缺少什么,因为我无法看到已删除的内容。

<?php
/*
Template Name: Display Authors
*/

// Get all users order by amount of posts
$allUsers = get_users('orderby=post_count&order=DESC');

$users = array();

// Remove subscribers from the list as they won't write any articles 
foreach($allUsers as $currentUser)
{
if(in_array( 'contributor', $currentUser->roles ))
{
$users[] = $currentUser;
} 
}
?>

<?php get_header(); ?>
<section class="content-area" role="main">
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="authors">
<?php foreach($users as $user) { ?>
<div class="page-author author-<?php echo ($curauth->ID & 1 ? 'odd' : 'even'); ?>">
        <div class="author-avatar">
        <?php echo get_avatar( $curauth->user_email, '200' ); ?>
    </div>
        <div class="author-info">
            <h2 class="author-name"><?php echo $curauth->first_name . ' ' .            $curauth->last_name; ?></h2>
            <h3 class="author-username"><?php echo $curauth->nickname; ?></h3>
        </div>
        <div class="clearfix"></div>
            <p class="author-descrption"><?php echo   get_user_meta($curauth->ID,'description', true); ?></p>
</div>
<?php
}
 ?>
 </div>
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

更新:

所以这是我的代码中的更新,但仍然没有运气,页面上的所有用户信息仍为空。所以它没有显示名字,昵称,生物......没什么

<?php
/*
Template Name: Display Authors
*/

// Get all users order by amount of posts
$allUsers = get_users('orderby=post_count&order=DESC');

$users = array();
// Remove subscribers from the list as they won't write any articles
foreach($allUsers as $currentUser)
{
if(in_array( 'contributor', $currentUser->roles ))
{
$users[] = $currentUser;
}
}
?>
<?php get_header(); ?>
<section class="content-area" role="main">
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="authors">
<?php foreach($users as $user): ?>
<div class="page-author author-<?php echo ($curauth->ID & 1 ? 'odd' : 'even'); ?>">
        <div class="author-avatar">
            <?php echo get_avatar( $curauth->user_email, '200' ); ?>
    </div>
        <div class="author-info">
            <h2 class="author-name"><?php echo $curauth->first_name . ' ' .  $curauth->last_name; ?></h2>
            <h3 class="author-username"><?php echo $curauth->nickname; ?></h3>
        </div>
        <div class="clearfix"></div>
        <p class="author-descrption"><?php echo get_user_meta($curauth->ID, 'description', true); ?></p>
</div>
<?php endforeach; ?>    
</div>
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

0 个答案:

没有答案