[resolved] How do i reduce this to one loop? (3 posts)

  1. Ahrengot
    Posted 5 years ago #

    Hello guys,

    I have the following code that i would like to optimize by reducing the 2 loops to a single one.

    Problem is that there's some specific code i only need run once(the nav and section elements). Those need to be outside the loop, so i'm forced to close the nav loop before i can begin the section loop.

    Any help would be greatly appeciated.

    You can see what i have here: http://pastebin.com/VChkx4yR

  2. Michael
    Forum Moderator
    Posted 5 years ago #

    you can remove the second identical query by using rewind_posts() instead, however, afaik, you will need to keep the two loops.


  3. Ahrengot
    Posted 5 years ago #

    Wow, what a neat little function. That means I don't even have to do any refactoring of my markup.

    Thanks a lot :)

Topic Closed

This topic has been closed to new replies.

About this Topic