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?
-
Can see exmpale of use here:
http://www.geekestateblog.com/php-code-for-an-author-sidebar-module-for-a-multi-author-wordpress-blog/please help
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.
i do this but not work
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!
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?
Thanksplease help me
Ohhhh sorry for the wrong answer. But can I know whether there are any authors on your site?
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…..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>
oooooo!!! thanks! i’m very stupid…..
- The topic ‘Show authors in sidebar with info and picture’ is closed to new replies.