我已经为这个目的准备了一些东西,如果你不喜欢它的显示方式,你需要更改它。。。无论如何:
In My Opinion you need to:
1。抓取所有作者(放入一个数组)
2。在构建列表时通过该数组运行
3。放松并享受结果;)
Please Note...
我认为在一个页面中显示所有作者是个坏主意,因为加载可能需要很多时间,因此可以通过更改变量设置希望显示的作者数量:$howManyAuthors
原来的代码应该归功于其他人,但这是很久以前我接受并定制的。。。如果你想看看这个朋友-谢谢
<div class="authorsContainer">
<?php
//define vars from user selection
$howManyAuthors = 50;
//Get users and count of posts put into array
$authorsArray=array();
$blogusers = get_users_of_blog();
if ($blogusers) {
foreach ($blogusers as $bloguser) {
$post_count = get_usernumposts($bloguser->user_id);
$authorsArray[$bloguser->user_id]=$post_count;
}
arsort($authorsArray);
$maxauthor = $howManyAuthors;
$count=0;
foreach ($authorsArray as $key => $value) {
$count++;
if ($count <= $maxauthor) {
$user = get_userdata($key);
$username = $user->user_login;
$displayname = $user->display_name;
$author_posts_url = get_author_posts_url($key);
$post_count = $value;
?>
<div class="topWriterBox">
<div class="topWriterName">
<a href="<?php echo $author_posts_url; ?>"><?php echo $displayname; ?> </a>
</div>
<div class="topWriterArticles"><?php echo __(\'Published: \', \'\').$post_count.__(\' Articles\', \'\'); ?></div>
<br class="clr" />
<h4><?php _e(\'Latest Article:\', \'\'); ?></h4>
<ul>
<?php
$args=array(
\'showposts\'=>1,
\'author\'=>$user->ID,
\'caller_get_posts\'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
?>
<!--============ THE AUTHORS ARTICLE DATA ================-->
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permenent Link To <?php the_title_attribute(); ?>"><?php the_title(); ?></a> <small>(<?php the_time(\'m.d.y\') ?></small>)</li>
<?php
endwhile;
}
?>
</ul>
</div><!-- end of topWriterBox -->
<?php
}
}
}
?>
</div>
。
您可以看到example here (这是希伯来语,不是问题,吉尔?
希望这有帮助,干杯,萨吉夫。