WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Show authors in sidebar with info and picture (12 posts)

  1. webdiv
    Member
    Posted 3 years ago #

    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?

  2. webdiv
    Member
    Posted 3 years ago #

  3. webdiv
    Member
    Posted 3 years ago #

    please help

  4. Darrell Schauss
    Member
    Posted 3 years ago #

    Make sure you replace all single quotes and double quotes with plain quotes ' and ". As copy paste from the blog they are fancy/curly quotes that dont copy correctly.

  5. webdiv
    Member
    Posted 3 years ago #

    i do this but not work

  6. Thejas Kamath
    Member
    Posted 3 years ago #

    There may be mistake with the code you have pasted in the sidebar. There is one more solution, you can activate a new plugin called Cool Author Box from WordPress admin panel. You need not edit any of the code in this plugin.

    Hope this helped you!

  7. webdiv
    Member
    Posted 3 years ago #

    hello i need show list of author in sidebar and not in single post page!!

    Please can someone help me with code that I put on?
    Thanks

  8. webdiv
    Member
    Posted 3 years ago #

    please help me

  9. Thejas Kamath
    Member
    Posted 3 years ago #

    Ohhhh sorry for the wrong answer. But can I know whether there are any authors on your site?

  10. webdiv
    Member
    Posted 3 years ago #

    My site is a multi-blog author site, i need a sidebar list of last 10 contributors same this: http://www.geekestateblog.com/php-code-for-an-author-sidebar-module-for-a-multi-author-wordpress-blog/
    See sidebar.....

  11. Darrell Schauss
    Member
    Posted 3 years ago #

    Just to be sure...
    It may be confusing, but if you have any code knowledge hopefully you figured it out.

    Example:
    this:
    <?php if( $user->aim != ”){ ?>
    should be two single quotes. representing blank string.
    <?php if( $user->aim != ''){ ?>
    and not a double quote even though they all look like doubles.
    not this: <?php if( $user->aim != "){ ?>

    These are doubles:
    <li><a href=”<?PHP echo $user->jabber ?>”>Blog</a></li>
    as
    <li><a href="<?PHP echo $user->jabber ?>">Blog</a></li>

  12. webdiv
    Member
    Posted 3 years ago #

    oooooo!!! thanks! i'm very stupid.....

Topic Closed

This topic has been closed to new replies.

About this Topic