0
我的博客中有一個作者列表,用於顯示在博客上撰寫的人。然而,有這個問題,即第一作者Facebook,Twitter和YouTube的值都相同的所有作者WordPress的作者列表頁面無法正常工作
這是代碼
<?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(); ?>
我在做什麼錯?
'$ author'在哪裏被初始化? – geomagas