Support » Fixing WordPress » Specific user post pages

  • I want my homepage to pull all the posts by the admin and I have two other pages to pull only specific posts from those authors.

    I thought I may be able to do this just by appending something in the querystring eg ?author=1 – can’t remember exactly but I got it working for the main page. Problem came when I tried to add this to the URL at the end of my custom template pages for the other authors, it’d put in an extra slash and bring up a 404. I’ve tried a bit of logic instead to bring up specific authors posts but these give me blank pages.

    Any ideas? Would be much appreciated.


Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator keesiemeijer



    try it with a query posts before the loop

      // The Query
      query_posts( 'author=123' ); // author ID
      // The Loop
      while ( have_posts() ) : the_post();
      // rest of loop

    That works great, thank you! Have it set up like this:

    <?php query_posts( ‘posts_per_page=3 && author=1’ ); ?>

    Another problem i didn’t realise before, but my “Newer” / “Older” links don’t appear to be working, have them set up like:

    <div class=”pagination”>

      <li class=”older”><?Php previous_posts_link(‘Older’) ?>
      <li class=”newer”><?php next_posts_link(‘Newer’) ?>


    Any ideas? Thanks so much for your help

    Moderator keesiemeijer



    try it with this:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts( 'posts_per_page=3&author=1&paged='.$paged );

    Something along the same lines is this, which basically shows posts belonging to administrators (you might have more than one admin).


    if (have_posts()) : while (have_posts()) : the_post();

    global $authordata;
    $user = new WP_User( $authordata->ID );

    if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
    if ( in_array(‘administrator’, $user->roles) )

    // …rest of loop code as usual


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Specific user post pages’ is closed to new replies.