Class not adding via loop
-
I’m having an issue getting a class to add to my posts. I need every other class to add fr to the post class. And the rest fl. So the posts fal into side by side columns on the home page.
Can anyone see where i’m going wrong on the code below. beautyidentified.com
<div id="main-content" class="home"> <div class="content"> <div class="col-left"> <div id="main"> <!-- Post Starts --> <div class="box"> <?php // Split the main content pages from the options, and put in an array $featpages = get_option('woo_main_pages'); $featarr=split(",",$featpages); $featarr = array_diff($featarr, array("")); foreach ( $featarr as $featitem ) { query_posts('page_id=' . $featitem); if (have_posts()) : $counter = 0; while (have_posts()) : the_post(); $counter++;?> <div class="post <?php if ($counter == 1) { echo 'fl'; } else { echo 'fr'; $counter = 0; } ?>"> <div class="box-post-content"> <h2><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php if ( get_post_meta($post->ID, 'image', true) ) { ?> <img src="<?php echo get_post_meta($post->ID, "image", $single = true); ?>" alt="" class="home-icon" /> <?php } ?> <?php the_excerpt(); ?> <a href="<?php the_permalink() ?>">Read more</a></p> </div> <!-- box post --> <?php if ( $counter == 0 ) { echo '<div class="hl-full"></div>'; ?> <div style="clear:both;"></div> <?php } ?> <?php endwhile; endif; ?> </div> <!-- Post Ends --> <?php } ?> </div> <!-- box Ends --> <?php //endwhile; endif; ?> </div><!-- main ends --> </div><!-- .col-left ends -->
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Class not adding via loop’ is closed to new replies.