• Hi all,

    I am hoping someone might be able to help me with this, as I have searched but cannot seem to find the right codex to use.

    I want to display a list of author names with the number of post beside the name. This is easy enough but I want it to display only the post the author has made to a certain category(s).

    For example Joe Blow has 50 posts for category 1 and 30 for category 2. I would liek the list to only display category 2.

    -> Joe Blow (30)

    If this is possible I dont even know but if you someone could let me know it would be very much appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php
    //displays users along with count of posts each user has belonging to category 3
    $blogusers = get_users_of_blog();
    if ($blogusers) {
      foreach ($blogusers as $bloguser) {
        $user = get_userdata($bloguser->user_id);
        $userposts = get_posts('cat=3&showposts=-1&author='.$bloguser->user_id);
        $count=count($userposts);
        echo '<p>User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' . $user->user_lastname . ', posts in category 3: ' . $count . '</p>';
      }
    }
    ?>
    Thread Starter tianbo84

    (@tianbo84)

    Sorry for the late reply, driving for the past couple days. Thanks so much for the code, Ill give it a go.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display author name with post amount from certain category?’ is closed to new replies.