• Jaswinder0091

    (@jaswinder0091)


    Hi
    I want to show 12 latest post on a page , but 1-5 in 1st div and 6-12 in 2nd div.
    When i add new post, the last post from 1st div should shift to 2nd div and the last post in 2nd div moves out.

    Coding is preferable..

    Is it possible ??

    Thanks

Viewing 1 replies (of 1 total)
  • In general, use the code structure below to group posts in divs:

    $posts_per_row = 6;
    $counter = 0;
    while ($counter < 10) {  // Use your own while condition
       if (++$counter % $posts_per_row == 1) {
          echo "start new row div<br />";
       }
       echo "content for $counter<br />";
       if ($counter % $posts_per_row == 0) {
          echo "end row div<br />";
       }
    }
    if ($counter % $posts_per_row != 0) {
          echo "end row div<br />";
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Recent Post’ is closed to new replies.