我正在写一个多作者的博客,我正试图制作一个作者列表,其中包含最近发表的类似于此页面的文章(网站是drupal):http://www.internationalrivers.org/blogs
我正在起草一份草案:http://nape.kevinmgibbons.com/authors
我想排除admin、ira和ivan(用户1、3、4)。
以下是我拼凑的代码:
<?php
$authors = $wpdb->get_results(\'SELECT DISTINCT post_author FROM \'.$wpdb->posts);
if($authors):
foreach($authors as $author):
?>
<div class="row authorentry">
<div class="col-lg-2">
<?php if(get_the_author_meta(\'description\', $author->post_author)): ?>
<div class=\'blog-avatar\'>
<?php echo get_avatar(get_the_author_meta(\'user_email\', $author->post_author), 80); ?>
</div>
<?php endif; ?>
</div><!-- /.col-lg-2 -->
<div class="col-lg-4 descriptionblock">
<div class=\'author\' id=\'author-<?php the_author_meta(\'user_login\', $author->post_author); ?>\'>
<h3 class="blogbyauthor"><?php the_author_meta(\'display_name\', $author->post_author); ?></h3>
<?php if(get_the_author_meta(\'description\', $author->post_author)): ?>
<div class=\'description\'>
<p class="blogbyauthor"><?php the_author_meta(\'description\', $author->post_author); ?></p>
</div><!-- /.description -->
</div><!-- /.author -->
</div><!-- /.col-lg-4 -->
<?php endif; ?>
<?php
$recentPost = new WP_Query(\'author=\'.$author->post_author.\'&showposts=4\');
while($recentPost->have_posts()): $recentPost->the_post();
?>
<div class="col-lg-6">
<ul class="blogbyauthor">
<li class="blogbyauthor" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php the_time(\'F jS, Y\') ?>
</li>
</ul>
</div><!-- /.col-lg-6 -->
<?php endwhile; ?>
<?php if(get_the_author_meta(\'twitter\', $author->post_author) || get_the_author_meta(\'facebook\', $author->post_author) || get_the_author_meta(\'linkedin\', $author->post_author) || get_the_author_meta(\'digg\', $author->post_author) || get_the_author_meta(\'flickr\', $author->post_author)): ?>
<?php endif; ?>
</div><!-- /.row -->
<hr>
<?php endforeach; endif; ?>
两个问题:
如何排除用户1、3、4?我在其他帖子中尝试了很多方法有没有更好/更干净的方法来做我想做的事情我对Wordpress PHP有点生疏,所以我很感谢您能提供的任何帮助。