• Resolved zeshan

    (@zeshan)


    i am using this code for top 10 authors it is working but i didnt get authors url. and i dont wana use plugin so any one kindly help me regarding this.

    <?php
    function topauthors() {
    
    $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=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->user_firstname . ' ' . $user->user_lastname .'(RSS) ('. $post_count. ')';
    
    }
    
    }
    
    }
    
    }
    
    ?>

    [Moderator note:] Please use a pastebin in future.

    my website is https://www.chowrangi.com

    i need top 10 authors by post and there url.

  • The topic ‘top 10 author’ is closed to new replies.