Support » Fixing WordPress » Remove single post from query

  • Hello, I have 2 queries on my single post page (single.php). My first query shows the full post for the article clicked, the second query shows the 3 latest posts in excerpt format, which happens to include the actual post being displayed.

    I’m using arras theme, and the double query is required, what I’m wondering is, is there a way to show the latest 3 posts in query 2 except for the full post being shown on that page?

    Since I suck at explaining, here’s an example:


    When mydomain/posts/newest is viewed, query 2 shows 2nd_newest, 3rd_newest and 4th_newest

    When mydomain/posts/2nd_newest is viewed, query 2 shows newest, 3rd_newest and 4th_newest

    When mydomain/posts/3rd_newest is viewed, query 2 shows newest, 2nd_newest and 4th_newest

    And so on and so forth.

    Is something like this possible? Thanks in advance for any enlightnement 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • Before you first loop, the loop that displays the single post, put


    and inside that first loop put:


    Then for your 2nd query something like:

      'post__not_in' => array($nodup),
    $my_query = new WP_Query($args);

    pretty useful code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove single post from query’ is closed to new replies.