• Resolved Everlast00

    (@everlast00)


    Hi guys,

    I got a long row of posts (portfolio items), horizontally. You can scroll through them. But how do I edit my script, if I want an extra </div><div>, so that the first row contains only 10 posts, and then continues on to the second row (below it).

    I tried giving all the items a number, and then with

    if($postnumber == 10){
        // go to the next row };

    I hope you guys understand the question :p

Viewing 2 replies - 1 through 2 (of 2 total)
  • you could try and use a counter in the loop:

    <?php
    if (have_posts()) : 
    
    $i = 0; //set counter
    
    while(have_posts() : the_post();
    /*loop stuff*/
    
    $i++; // increase counter
    if( $i%10 == 0 ) { echo '</div><div>'; } //check for multiple of 10
    
    endwhile;
    ?>
    Thread Starter Everlast00

    (@everlast00)

    Wow, that did the trick! Thank you very much! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add breaks every X posts’ is closed to new replies.