different background colors in the loop
-
I have this script:
<?php $args = array('post_type' => 'echipa'); $echipa = new WP_Query( $args ); if( $echipa->have_posts() ) { while( $echipa->have_posts() ) { $echipa->the_post(); ?> <div class='echipa_color'> <h1><?php the_title() ?></h1> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php the_content() ?> </div> </div> <?php } } else { echo 'Oh ohm no pages!'; } ?>
I need first post white background, second post gray background, third white again, then gray again and so on,
so I should have in the html instead: <div class=’echipa_color’>:<div class='echipa_white'>page1<div> <div class='echipa_gray'>page2<div> <div class='echipa_white'>page3<div> <div class='echipa_gray'>page4<div>
… and so on
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘different background colors in the loop’ is closed to new replies.