logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$4
Retrieve author name from $post->post_author (or other $post val)

I've created a custom database request in order to show the most popular posts on a site, now I'd like to publish the author of each of these posts. I haven't been successful in finding a method for retrieving the author name from $post->post_author however, which only gives me the ID of the author.

If it's of any help, here's my custom database call:

$result = $wpdb->get_results("SELECT ID, comment_count, post_title, post_date, post_author FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0, 5");


I've noticed some using "post_author_link" in a couple of tutorials but haven't been able to figure out if it can display the actual author name.

This question has been answered.

Staffan Estberg | 08/29/10 at 3:51pm Edit


(1) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    08/29/10
    4:06pm
    Utkarsh Kukreti says:

    $user_info = get_userdata($post->post_author);
    $first = $user_info->first_name;
    $last = $user_info->last_name;

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.