WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Show authors in sidebar with info and picture

[Resolved] Show authors in sidebar with info and picture

  • Hello guys
    I have a Article Marketing blog, i like show last 5 or 10 authors on sidebar with info and picture (gravatar or user photo) but i can find appropriate code for do this, so i find this code:

    <h2>Recent Contributors</h2>
    <div>
    <?php
    
    $limit = ’10';
    $query = “select post_author as ID, max(post_date)
    from $wpdb->posts
    where post_type = ‘post’ and post_status = ‘publish’
    group by post_author
    order by 2 desc
    limit $limit;”;
    $usersinfo = $wpdb->get_results($query);
    foreach($usersinfo as $userinfo){
    $user = get_userdata($userinfo->ID);
    $user->postcount = $userinfo->postcount;
    ?>
    
    <div>
    <?php if( $user->aim != ”){ ?>
    <img width=”57" alt=”<?php echo $user->aim; ?>”   src=”<?PHP echo $user->aim; ?>” />
    <? }else{
    ?>
    <img width=”57" alt=”no image”   src=”http://www.geekestateblog.com/images/blankphoto.jpg” />
    <?php } ?>
    <ul>
    <li><strong><?php echo $user->first_name;  ?> <?php echo     $user->last_name;  ?> </strong></li>
    
    <?php if ($user->yim != ”){  ?>
    <li><a href=”<?PHP echo $user->user_url; ?>”><?PHP echo $user->yim; ?></a></li>
    <? } ?>
    
    <?php if ($user->jabber != ”){ ?>
    <li><a href=”<?PHP echo $user->jabber ?>”>Blog</a></li>
    <? } ?>
    
    <li> <a rel=”nofollow” href=”http://www.geekestateblog.com/author/<?PHP echo $user->user_login ?>”>View Posts</a> | <a rel=”nofollow” href=”<?php echo get_author_feed_link($user->ID); ?>”>RSS</a></li>
    </ul>
    </div>
    <?php
    }
    ?>
    </div>

    But it not work correctly, can help me please?

Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] Show authors in sidebar with info and picture’ is closed to new replies.
Skip to toolbar