• Resolved sharecommons

    (@sharecommons)


    Hello guys,

    I’m trying to understand what this code does:

    <?php
                    $authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts);
                    if($authors):
                    foreach($authors as $author):
    ?>

    Would appreciate if you guys can explain it line by line.
    Thanks a lot.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Here is an interpretation of the code:

    get an array of author ids from the posts table
    if there are any author ids
      loop through the author ids array one author id at a time
    Thread Starter sharecommons

    (@sharecommons)

    Hello vtxyzzy,

    Thank you for the reply. Would it be possible for you to help me with this thread: http://wordpress.org/support/topic/templating-authorphp

    I have this code in my author.php file and I’m trying to create some query to work out my author.php file. As you can see, I’m not that good with coding but trying to learn. Interacting with database is a little out of my understanding. Please help if you can.

    Appreciate your help, thank you.

    Check your other thread.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘What does this code do?’ is closed to new replies.