• Resolved changeco

    (@changeco)


    I’ve been searching around for a while and either I’m stupid, probably, or am not searching for the right keywords, definitely, but I need to display a list of posts from one author…

    I’ve displayed a list of the last 5 posts

    <?php
             $my_query = new WP_Query('showposts=5');
    
             while ($my_query->have_posts()) : $my_query->the_post();
             $do_not_duplicate = $post->ID;
            ?>

    is there some what to pull out the last 5 (or whatever) posts from a specific author?

    Any help would be greatly appreciated…

    Thanks,
    Ted

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php
    $args=array(
      'author' => 3,
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => 5,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo 'List of 5 Posts for author id 3';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        <?php
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    query_posts()
    How do I determine a Post, Page, Category, Tag, Link, Link Category, or User ID?

    Thread Starter changeco

    (@changeco)

    Thank you @michealh – that is a perfect solution! Thank you for the links, I’m going to fish now!

    I don’t like to get dramatic but OMG I just spent an hour looking and finally found this code.

    Awesome.

    Thanks MichaelH & thanks changeco.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Author specific post titles’ is closed to new replies.