Support » Fixing WordPress » author posts outside the loop

  • Hi I’m using the current code to retreive all the posts of the current page’s author, and skip the current post id, which is 159

    <?php query_posts("author", $theauthorid);
    while (have_posts()) : the_post(); if( $post->ID == '159' ) continue; ?>

    basically I need to skip the current post – so how would I do that automatically? ie replace the 159 in the code above with whatever the current post id is?


Viewing 1 replies (of 1 total)
  • got it

      //Gets author info and current post id
      global $wp_query;
      $postAuthor = $wp_query->post->post_author;
    $tempQuery = $wp_query;
      $currentId = $post->ID;
    while (have_posts()) : the_post(); if( $post->ID == $currentId ) continue; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘author posts outside the loop’ is closed to new replies.