WordPress中的作者列表页面效果不佳

时间:2013-10-12 22:33:14

标签: wordpress

我的博客中有作者列表,以显示在博客上撰写的人。但是,第一作者的FaceBook,Twitter和YouTube值对于所有作者来说都存在这个问题

这是代码

<?php
/*Template Name: قائمة محررى الموقع*/
// 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( 'subscriber', $currentUser->roles ))
{
$users[] = $currentUser;
}
}
?>
<?php get_header(); ?>
</div>
<section id="auther-list-temp" role="main">
<?php
foreach($users as $user)
{ ?>
<div class="author">
<div class="authorAvatar">
<?php echo get_avatar( $user->user_email, '128' ); ?>
</div>
<div class="authorInfo">
<h2 class="authorName"><?php echo $user->display_name; ?></h2>
<p class="authorDescrption"><?php echo get_user_meta($user->ID, 'description', true); ?></p>
<p class="authorLinks"><a href="<?php echo get_author_posts_url( $user->ID ); ?>">اعرض جميع مواضيع العضو</a></p>
<?php $website = $user->user_url;
if($user->user_url != ''){
printf('
<div class="site-name"><a href="%s">%s</a>
', $user->user_url, 'الموقع');
} ?></div>          
<?php if(get_the_author_meta('twitter', $author->post_author) || get_the_author_meta('facebook', $author->post_author) || get_the_author_meta('youtube', $author->post_author) || get_the_author_meta('digg', $author->post_author) || get_the_author_meta('flickr', $author->post_author)): ?>
<ul class='connect'><?php if(get_the_author_meta('twitter', $author->post_author)): ?>
<li class="twitter-name"><a href='http://twitter.com/<?php the_author_meta('twitter', $author->post_author); ?>'>twitter</a></li><?php endif; ?>
<?php if(get_the_author_meta('facebook', $author->post_author)): ?>
<li class="facebook-name"><a href='http://www.facebook.com/<?php the_author_meta('facebook', $author->post_author); ?>'>facebook</a></li><?php endif; ?>
<?php if(get_the_author_meta('youtube', $author->post_author)): ?>
<li class="youtube-name"><a href='http://www.youtube.com/<?php the_author_meta('youtube', $author->post_author); ?>'>youtube</a></li>
<?php endif; ?><?php endif; ?></ul>
</div></div>
<?php } ?>
</section>
</div>
<?php get_footer(); ?>

我做错了什么?

1 个答案:

答案 0 :(得分:0)

那是因为你只是为当前文章的作者展示了FaceBook,Twitter和YouTube的价值。

尝试用$author->post_author替换$user->ID的每一次出现。