The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WP: How Do You Get A List Of Posts By A Specific Author

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
  • #25336

    I have been across the net trying to get a way to generate a list of posts posted by a specific author.
    The site is for a band and I have a member page for each person in the band. I want to have a list of posts specific to the member come up just like wp_list_archives or something along those lines but I havn’t found anything useful in over 3 hours of searching and testing.

    Anyone know how to do this, I’d really appreciate it.


    Surely the simplest way of doing it is to assign each band member their own category and then have a list of posts in that category.


    You can actually accomplish this using the query_posts: … Parameters



    @apostrophe I had been thinking of doing that

    Could you paste in the exact code i need, I’d be using author ID 1. Its not lazyness its just that I tried the query posts before and got bad php errors. I’m not good with php yet so I don’t understand why things don’t work

    Thanks for the help.


    You did not read that link I posted my friend!

    haha no worries, this is how a query_post should look in it’s most basic form:


    Basically, you have to make sure it comes BEFORE the loop, or else you’re hooped.


    I had tried that code before but I got this error

    Parse error: syntax error, unexpected ‘.’ in /home/chequeredmaniac/kosmonauts/wp-content/themes/kosmonauts/members.php on line 14

    Tried it again just in case and I got the same thing.
    I’ve tried placing the code both above and below the header. I’m using a custom page which doesn’t use the loop, or at least there no code there for it and there’s no template tag inserting it.



    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin erat sem, euismod quis laoreet vel, aliquet id dolor. Vestibulum eget urna pretium felis posuere faucibus convallis in quam. Suspendisse turpis lectus, ullamcorper vitae malesuada fringilla, condimentum eu enim. Sed at ipsum eros, vitae auctor mi. Maecenas convallis dignissim lorem. Quisque eget diam felis. Nulla nisl diam, feugiat accumsan porttitor et, bibendum ornare sapien. Donec tincidunt nunc in ante lacinia rutrum. Fusce interdum nulla sit amet nisl tempus eu iaculis orci ultrices. Aenean egestas sodales urna at hendrerit. Sed vitae pharetra arcu. Maecenas et porta elit. Fusce rhoncus iaculis erat congue lobortis. Suspendisse posuere, sapien ac tempor iaculis, purus urna euismod libero, sit amet bibendum dui massa ac dolor.


    full name: Kilian McMahon
    age: 18
    plays: Drums + Sings

    • idiot pilot
    • fall out boy
    • reuben
    • god is an astronaut
    • motion city soundtrack

    fave film: fight club/hackers

    fave food: fried noodles


    kit 5 piece pearl export elx

    • 14″ AA Metal-X Hi-Hats
    • 16″ AA Metal-X Crash
    • 22″ AA Metal-X Ride
    • 18″ Vaults Crash
    • 20″ Paragon China

    ADD ME

    twitter @kilmc
    facebook Kilian McMahon
    flickr Kilmc
    vimeo Kilmc
    myspace iAmDarknoise
    bebo ChequeredManiac

    That’s the page and all its code.

    Could be something else causing they problem that you might spot.


    You can’t put in exactly what I’ve written.

    If the page doesn’t have a loop, then it won’t show any posts. I was under the impression that the page already had a loop and was showing posts by all authors.

    If you don’t know about the loop, I’m afraid you’re going to have to take a few steps back and figure that out before you start stepping into modifying it.


    I think it would be a whole lot easier if I just used categories. It removes a lot of hastle. If it’s a page its not going to have all the posts in the same way the index.php loop has. So I can’t see how even including the loop on a page will allow me to use query posts in the way I want to.

    The categories method is definitlely suited to this project. I’m under time constraints but I may figure out a way of doing it in the future.

    Thanks for all the help


    I completely disagree.

    You can use the WP loop anywhere, not just on an index page. If you’re going to show posts from a user, you’re going to have to use a loop, there’s no way around that.

    To display posts from only one category, you’re still going to use query_posts.


    I don’t think I actually explained this properly. I just want to display a list of links in a column of links that the member has posted. I don’t actually want the page displaying the posts. That’s not the purpose of that page.

    So all I need are link of, say the 5 most recent, posts by that author.


    Oooohhhhhh I gotcha now.

    Here ya go!

    get_results(“SELECT * FROM $wpdb->posts WHERE post_author = 1”);

    echo “Posts by Author 1”;

      foreach ($numposts as $numpost) {
      echo “

    • “.$numpost->post_title.”
    • “;



    Thats definitely on the right track however I am now getting a list of everything I have published as that author, like pages etc. I also seem to be getting revisions or comments because a lot of the post names are showing up multiple times. Is there a way to only query blog posts?

    Finally I need them to be links. So where would I wrap an a tag to get this to happen? Or would it be more complicated than that.

    I really appreciate all this help. I wouldn’t be able to do any of this without your help.



    This is the code I use on a custom page template to achieve something similiar to what you are aiming for.
    In order for this to work you have to assign the template to a page like normal. Then create a custom field called "author" and assign this a value of the author id whose posts you wish to appear.


    Recent blog posts

    ID, ‘author’, true)) :
    if ( have_posts() ) : ?>

    This person doesn’t have a blog yet.

    I really hope that this helps you. Please let me know how you get on.


    Just stumbled across this, have you tried it? … wordpress/


    @TheDoc, I had tried it, couldn’t get it to work.

    Thank you so much. It is perfect, exactly what I wanted. I appreciate it so much. Let me know if I can help anytime, I’m a graphic designer. Just email me or @ reply me on twitter for any design stuff you need.

    Also thanks to TheDoc for all your help. Really appreciate it.

    Wahoo, its fixed.

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.