Support » Fixing WordPress » Using a query result multiple times with differnt limit

  • Hi, i am getting query result by query_posts and settings the post_per_page = -1 so i get all the posts depending on the query.

    Now i am showing the result multiple times in a page via the loop. Now my question is is there any way that i limit the result showing in different parts on the page?

    In the top i am showing a slider where i used has_post_thumbnails to show only the featured images.

    In the middle i need to show the recent posts with pagination.

    I hope you get the idea. If not let me know. I will try to explain again.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Try creating new queries. This should explain it all:

    If this doesn’t work, let us know.

    If this topic is solved, please mark it as “Resolved” on your right sidebar.


    Hi, sean. I surely can create a new query but i am trying to save unnecessary sql queries.

    @alchymyth: Thanks! I have checked those and not what i want. Here with an example:

    1. I have make a query which returns me all the posts.
    2. Now we have the results so we can use the rewind_posts() for echo the post as many times as we want in the page, right?
    3. Now the real issue 🙂 the post_per_page; For the first one i am screening the has_post_thumbnail to show 5 featured image.
    4. In middle i will show the post that will paginate.
    5. The lower area the post will be screening by post format ‘quote’ 😀

    i can do it via the old school break;

    $i =1; $limit = 5;
    while(){//the while in the loop
     //do stuff
     if($i == $limit) break; else $i++;

    i just wanted to know if wordpress has anything available to modify the results so i don’t have to do it manually.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using a query result multiple times with differnt limit’ is closed to new replies.