• Resolved pfernandezm59

    (@pfernandezm59)


    I’m a neewbe in wordpress and I would like to know how can I display a list of TOP 10 authors in my blog with this format?:

    1. [Author name] [xx posts] [Last Post Title] [Date of last post title]
    1. [Author name] [xx posts] [Last Post Title] [Date of last post title]
    1. [Author name] [xx posts] [Last Post Title] [Date of last post title]
    1. [Author name] [xx posts] [Last Post Title] [Date of last post title]
    1. [Author name] [xx posts] [Last Post Title] [Date of last post title]
    1. [Author name] [xx posts] [Last Post Title] [Date of last post title]
    1. [Author name] [xx posts] [Last Post Title] [Date of last post title]

    I’m using wordpress 2.8.4, with Brandford’s Magazine Theme (www.wp-themes.der-prinz.com/magazine) for a spanish basketball blog that’s now under construction (www.cbgranollers.com).
    Thank you very much in advance
    Thank you very much in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter pfernandezm59

    (@pfernandezm59)

    Thank you very much MichaelH, but I was wondering also How can I restrict that code only to show me top 10 authors ordered by $post_count?
    Thank you, again

    <?php
    //Get users and count of posts put into array $uc, sort array by post count ascending, loop through array and echo user info, get latest post for each user and display time and title
    $uc=array();
    $blogusers = get_users_of_blog();
    if ($blogusers) {
      foreach ($blogusers as $bloguser) {
        $post_count = get_usernumposts($bloguser->user_id);
        $uc[$bloguser->user_id]=$post_count;
      }
      arsort($uc); //use asort($uc) if ascending by post count is desired
      $maxauthor=2;
      $count=0;
      foreach ($uc as $key => $value) {
      $count++;
        if ($count <= $maxauthor) {
          $user = get_userdata($key);
          $author_posts_url = get_author_posts_url($key);
          $post_count = $value;
          echo 'User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' . $user->user_lastname . ' number of posts: ' . $post_count . ' author posts url: ' . $author_posts_url .'';
          $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(); ?>
              <p><small><?php the_time('m.d.y') ?></small> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
              <?php
            endwhile;
          }
        }
      }
    }
    ?>
    Thread Starter pfernandezm59

    (@pfernandezm59)

    sorry, but not working for me. I copied and pasted in one post through my dashboard editor, and this is the result:

    user_id); $uc[$bloguser->user_id]=$post_count; } arsort($uc); $maxauthor=10; $count=0; foreach ($uc as $key => $value) { $count++; if ($count <= $maxauthor) { $user = get_userdata($key); $author_posts_url = get_author_posts_url($key); $post_count = $value; echo ‘User ID ‘ . $user->ID . ‘ ‘ . $user->user_firstname . ‘ ‘ . $user->user_lastname . ‘ number of posts: ‘ . $post_count . ‘ author posts url: ‘ . $author_posts_url .”; $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(); ?>

    Any suggestions?
    Thank you again MichaelH

    Well it’s working for me…

    https://wordpress.pastebin.ca/1633379

    Thread Starter pfernandezm59

    (@pfernandezm59)

    Thank you very much MichaelH
    The code is working fine now!!!

    Is possible sort list by current month and particular category?
    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘List of top 10 authors in the blog with some’ is closed to new replies.