Loop Issue Foreach
-
Hello,
I’m having trouble with a loop that uses foreach.
I’m using SMOF (slightly modified options framework) to list an array of images which are placed into a flex slider.
Heres the old code which works…. (but the issue with this is, I dont know how to specify the image sizes)
<?php $slides = $data['pingu_slider']; //get the slides array foreach ($slides as $slide) { echo '<li> <a href="'. $slide['link']. ' "> <img src="' . $slide['url' ] . '" /> </a> <div class="flex-title">'. $slide['title']. ' </div> <div class="flex-caption">'. $slide['description']. ' </div> </li>'; } ?>
Heres the new code, which will specify the image size, but it only shows the first image.
<div class="row"> <div class="large-12 columns"> <div id="slider" class="flexslider"> <ul class="slides"> <?php $loop = new WP_Query( array( 'pingu_slider' ) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php foreach ($loop as $loop) { ?> <li> <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'small-thumb' ); } ?> </li> <?php }endwhile; ?> </ul> </div> </div>
Many many thanks to anybody that can help.
Cheers
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Loop Issue Foreach’ is closed to new replies.