• Resolved callender

    (@jimcallender)


    Hi there,

    I am using this post to show the latest avatars / authors:

    https://www.wpbeginner.com/wp-tutorials/how-to-display-an-author-list-with-avatars-in-wordpress-contributors-page/

    Have it working fine for alphabetical list of ALL authors.

    ===

    We only want to show 6 avatars, also show contributor accounts only.

    How do we rewrite this in functions.php?

    Currently:

    // function for author avatar list on homepage
    function contributors() {
    global $wpdb;
    
    $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users ORDER BY display_name");
    
    foreach($authors as $author) {
    echo "<li>";
    echo "<a href=\"".get_bloginfo('url')."/?author=";
    echo $author->ID;
    echo "\">";
    echo get_avatar($author->ID);
    echo "</a>";
    echo "</li>";
    }
    }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show recent avatars from contributor level’ is closed to new replies.