• Hi,

    Does anyone know what code I could add to my sidebar.php to display the posts of the currently logged in user?

    Thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter a1anm

    (@a1anm)

    Hi,

    I found this piece of code which displays the posts of a specified author:

    <?php
    $numposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_author = 1");
    echo "Posts by Author 1";
    
    <ul>
    foreach ($numposts as $numpost) {
    echo "
    <li>".$numpost->post_title."</li>
    ";
    }
    </ul>
    ?>

    All I need to do now is alter this to display the posts of the currently logged in user instead.

    Anyone know how to do this?

    Cheers!

Viewing 1 replies (of 1 total)
  • The topic ‘Display Posts of Logged in User’ is closed to new replies.