getting authors posts issue
-
i want to get last authors 3 posts at my home page. only author posts as level=4. here are my codes but it doesn’t get the post. there is no result when run the codes. is there any idea?
<?php $authors = get_users_of_blog(); ?>
<?php
$latest_posts = array();
foreach ( $authors as $author ) {
$user = new WP_User( $author->ID );
if ($user->has_cap(‘level_4’))
continue;
$ps = get_posts(‘numberposts=3&post_type=post&author=’ . $author->ID);
foreach ($ps as $p) {
$latest_posts[$p->post_date] = $p;
}
}
krsort($latest_posts);
?>
<?php
$counter =0;
foreach ($latest_posts as $post) {
$counter++;
if ($counter > 3)
break;
setup_postdata($post);
?>
<div class=”yazar_alan”>
<div style=”float:left; padding-right:10px;”>
<?php userphoto_the_author_thumbnail(); ?>
</div>
<div style=”float:left;”>
<div class=”yazi_baslik”>” class=”siyah_renk”><?php the_title(); ?></div>
<div class=”yazar_adi”>” class=”siyah_renk ver11″><?php the_author_meta(‘first_name’); ?> <?php the_author_meta(‘last_name’); ?></div>
</div>
</div>
<?php } ?>
The topic ‘getting authors posts issue’ is closed to new replies.