Struggling with third loop.
-
Hi All,
I am creating a static homepage for my project that will require 3x loops:
1) Display the latest 4 posts from news category.
2) Display the latest 4 post from shows category.
3) Image slider at the start of the page displaying 3 latest three posts from slider category.I have loops 1 & 2 working in the code below, but am unable to get my third loop working before them. My slider posts are simple a title and a custom field “slider-image” that contains the full image url.
<!-- Begin Content --> <div id="content"> <div class="wrap"> <div class="round-top"></div> <div id="main-content"> <div id="news-col" class="left"> <h2>Latest Rally News</h2> <?php if(is_home()) {query_posts('cat=1&showposts=4'); } ?> <?php while (have_posts()) : the_post (); ?> <div class="date left"> <p class="month"><?php the_time(M); ?></p> <p class="day"><?php the_time(d); ?></p> </div> <h3> <a href="<?php the_permalink() ?>"><?php the_title(); ?></a> </h3> <p><?php the_excerpt_rss(); ?></p> <div class="clearboth"></div> <?php endwhile;?> </div> <div id="shows-col" class="right"> <h2>Previous Shows</h2> <?php query_posts('cat=3&showposts=4'); ?> <?php while (have_posts()) : the_post (); ?> <h3> <a href="<?php the_permalink() ?>"><?php the_title(); ?></a> </h3> <?php the_content(); ?> <?php endwhile;?> </div> <div class="clearboth"></div> </div> <div class="round-bottom"></div> </div> </div> <!-- End Content -->
My latest attempt is:
<div id="s3slider"> <ul id="s3sliderContent"> <?php query_posts('cat=4'); ?> <?php while (have_posts()) : the_post (); ?> <li class="s3sliderImage"> <img src="<?php echo get_post_meta($post->ID, “slider-image”, $single = true); ?>" alt=”<?php the_title(); ?>” /> <span><?php the_excerpt(); ?></span> </li> <?php endwhile; ?> <div class="clear s3sliderImage"></div> </ul> </div>
This is not working as no image shows up. I have tried another option using $my_query = new WP_query but that did not work either.
Can you help me close this gap in my knowledge?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Struggling with third loop.’ is closed to new replies.