Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7899379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:41:12+00:00 2026-06-03T08:41:12+00:00

My Bootstrap grid is 910px spanning 15 columns. Each post in my WordPress loop

  • 0

My Bootstrap grid is 910px spanning 15 columns. Each post in my WordPress loop spans 5 columns.

Here’s the static code:

<div class="container">     

    <div class="row">

        <div class="span5">
            <p>Post title and image</p>
        </div>

        <div class="span5">
            <p>Post title and image</p>
        </div>

        <div class="span5">
            <p>Post title and image</p>
        </div>

    </div>

</div>

And then here’s roughly how it would look with the loop:

<div class="container">     

    <?php theloop; ?>

</div>

Unless there’s a better way, I think I want to tell WordPress to say:

  • Make a variable $counter
  • For every post, increase the value by one
  • Where the value is one, start the post with div class="row"
  • Where the value is three, start the post with </div> (closing the row)
  • Reset $counter to zero after reaching three and start again

I don’t know how to do this. I’ve asked for help with a similar issue before but I’m totally new to PHP, I’d really appreciate a clear breakdown and explanation.

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:41:14+00:00Added an answer on June 3, 2026 at 8:41 am

    Try it somehow like this:

     <?php 
     $i=1;
     echo '<div class="row">';
     if (have_posts()) : ?>
               <?php while (have_posts()) :   
               // do stuff ...
               the_post();
               if($i % 3 == 0)
                   echo '</div><div class="row">';
               $i++; endwhile; ?>
     <?php endif; ?>
    

    I didn’t test it, but somehow like this. Use the modulo function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw this selector in Twitter Bootstrap: .show-grid [class*=span] { background-color: #eee; text-align: center;
bootstrap popover currrently expects this: <a href=# id=example class=btn btn-danger rel=popover data-content=It's so simple
Case with bootstrap: Example code function( $ ){ }( window.jQuery );
I'm using twitter bootstrap . I have a div with 25 px padding. I
I am using Twitter Bootstrap and at one place I have nested fluid-grid in
Using Twitter's Bootstrap's standard 940px fluid grid responsive grid I'm trying to get multiple
I'm having trouble with Bootstrap which some people here seem to know about. I
In twitter bootstrap js tabs i have to add a class active to a
I am currently writing a little bootstrap code for a service that can be
(define bootstrap-c-code (define (from-file file-name) (let* ((ip (open-input-file file-name)) (res (read-text-file-from-input-port ip))) (close-input-port ip)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.