Multiple loops on a page pulling content & images from post not working
-
Can anyone help me fix this loop I just want it to display only the posts from the mlinks category including the image and content. But it’s not working as expected can someone please end my 1 week of frustration!
Attached is the code thats powering the links at the bottom in the grey box:
https://propono.co.uk/clients/curo/medical-reimbursement
Whatever I try I can’t get it to pull out the images and the content.
I have categories called mlinks, llinks and plinks, and will need to do this on three different pages.
So I’m trying to produce:
image 1 post 1 | image 4 post 6
image 2 post 2 | image 5 post 6
image 3 post 3 | image 6 post 6<div id="link-box"> <p id="linkbox-top">Medical Reimbursement Links</p> <?php query_posts('category_name=mlinks&showposts=3'); ?> <?php $posts = get_posts('numberposts=3&offset=0'); foreach ($posts as $post) : start_wp(); ?> <?php static $count1 = 0; if ($count1 == "3") { break; } else { ?> <div class="linkgroup"><!-- FIRST LOOP: display posts 1 thru 3 --> <div class="small-boxes"> <div id="img"><img src="<?php echo get_post_meta($post->ID, 'medical', true); ?>" alt="slide<?php the_ID(); ?>" width="84" height="55"/></div> <div id="txt"> <h5 class="txt1"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h5> <?php echo content(); ?> </div> </div> </div> <?php $count1++; } ?> <?php endforeach; ?> <?php query_posts('category_name=mlinks&showposts=3'); ?> <?php $posts = get_posts('numberposts=3&offset=3'); foreach ($posts as $post) : start_wp(); ?> <?php static $count2 = 0; if ($count2 == "3") { break; } else { ?> <div class="linkgroup"><!-- SECOND LOOP: display posts 1 thru 3 --> <div class="small-boxes"> <div id="img"><img src="<?php echo get_post_meta($post->ID, 'medical', true); ?>" alt="slide<?php the_ID(); ?>" width="84" height="55"/></div> <div id="txt"> <h5 class="txt1"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h5> <?php echo content(30); ?> </div> </div> </div> <?php $count2++; } ?> <?php endforeach; ?> </div>
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Multiple loops on a page pulling content & images from post not working’ is closed to new replies.