pealo86 Posted November 3, 2011 Share Posted November 3, 2011 This problem is a little more complex than I thought. I'm trying (in Wordpress) to output 3 <span> elements in each iteration of the loop. However each <span> element needs to advance the loop to the next iteration (if that makes sense). See here: <?php $count = 0; ?> <?php if(have_posts()) : ?> <?php while(have_posts()) : the_post(); ?> <div class="divide"> <span> <a href="<?php the_permalink(); ?>"> <span class="icon-home"><img src="<?php bloginfo('template_url'); ?>/image/icon-home-01.png" alt="Property" /></span> <span class="content"><?php the_title(); ?></span> </a> </span> </div> <?php $count ++; ?> <?php endwhile; ?> <?php endif; ?> There needs to be 3 <span> elements inside each <div class="divide" /> element. One thing I did try was to include a for loop inside 'div.divide' so that it output 3 of the <span> elements. But then I realised it simply output 3 of the same elements (e.g. all of the 'the_title()' fields were the same instead of advancing onto the next post). Does anyone have an idea how I can achieve it? Hopefully that makes sense, but I'm having trouble explaining it! MOD EDIT: . . . tags fixed . . . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.