• Resolved bryananthonylewis

    (@bryananthonylewis)


    I’m trying to wrap every 2 posts with a class of “row-fluid”… html example below…

    <div class="row-fluid">
        <div class="post 1"></div>
         <div class="post 2"></div>
    </div>
    <div class="row-fluid">
        <div class="post 1"></div>
         <div class="post 2"></div>
    </div>

    Right now I have the following html output

    <div class="row-fluid">
        <div class="post 1"></div>
         <div class="post 2"></div>
         <div class="post 3"></div>
         <div class="post 4"></div>
    </div>

    I’d like to set a count loop if its at all possible to achieve wrapper every two posts so I can use twitter bootstrap properly without having to tweak the css and over-ride what bootstrap already has.

    <?php
    
    					$args = array( 'post_type' => 'mysite_team', 'posts_per_page' => 10 );
    					$loop = new WP_Query( $args );
    					while ( $loop->have_posts() ) : $loop->the_post();
    
    						echo '<div ';
    							$even_odd = (++$j % 2 == 0) ? 'featured-image-wrapper-even-post span6' : 'featured-image-wrapper-odd-post span6'; post_class( $even_odd );
    						echo '>';
    
    						echo '<h1>';
    						echo '<a href="';
    							the_permalink();
    						echo '">';
    							the_title();
    						echo '</a></h1>';
    
    						echo '<div class="featured-image alignleft">';
    						echo '<a href="';
    							the_permalink();
    						echo '">';
    							the_post_thumbnail('team-thumbnail-size');
    						echo '</a>';
    						echo '</div>';
    
    						echo '<div class="entry-content">';
    							the_excerpt();
    						echo '<p><a href="';
    							the_permalink();
    						echo '"><i>Read More';
    						echo '</i></a></p>';
    						echo '</div>';
    
    						echo '</div>';
    
    					endwhile;
    
    					?>

    Any help would be awesome as I have tried a few things but keep getting white pages and no errors to go off of.

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bryananthonylewis

    (@bryananthonylewis)

    Brain fart… I figured it out! Thanks for taking a look!

    Could you please share your solution?

    I need to wrap every two posts as well, like this:

    <div class="wrap">
        …post1
        …post2
    </div>
    <div class="wrap">
        …post3
        …post4
    </div>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Wrap every 2 posts with a row-fluid’ is closed to new replies.