php - wordpress display second three posts -


i need display:

first 3 posts in first div wordpress,

second 3 posts in second div wordpress ,

third 3 posts in third div wordpress.

how can this?

div 1     --1st post     --2nd tpost     --3rd post div 2     --4th post     --5th post     --6th post div 3     --7th post     --8th post     --9th post 

you via several methods. put data array , chunk() it, , loop on chunks.

or, loop on data:

<div class="...">     <?php     // set counter     $i = 1;      // loop on posts     while (have_posts()) {         // if have ouputted 3 close , reopen div         if ($i == 3) {             $i = 1;              echo '</div><div class="...">';         }          // output post , increment counter         the_content();         $i++;     }     ?> </div> 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -