WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multiple loop question - featured items (2 posts)

  1. GATEKeeper
    Member
    Posted 7 years ago #

    Hate to bug folks with a PHP question like this, but can someone help me fix the front page of my site? I'm using a template to run multiple loops and show a featured item, along with 3 more headlines beside that. Then below that I want to do that all again and still not show the first item in the featured spot again. Here's the two sections of code I'm using - any help would be appreciated:

    <?php $my_query = new WP_Query('category_name=front-page&showposts=1');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;?>
    
       <div class="post">
    	<div class="storycontent">
    	<H5><?php the_category(' > '); ?></H5>
    	<CENTER><a href="<?php the_permalink(); ?>"><img class="post-image" BORDER=0 src="<?php post_image('', false, false); ?>"   /></a></CENTER>
    
    	<div class="title" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div>
    
     <TABLE WIDTH="350" BORDER=0 CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER class="story-table"><TR><TD>
    		 <?php the_excerpt_reloaded(35, '', '', true, '>> Read more'); ?>
    		 </TD></TR></TABLE>
    
    		 </div>
    		<?php wp_link_pages(); ?>
            <!--<?php trackback_rdf(); ?>  -->
    
     			</div>
      <?php endwhile; ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post();
      if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    <B>Recent Stories:</B><BR />
    <?php c2c_get_recent_posts(3, "<P>%post_URL% (%post_date%)<br />%post_excerpt_short%</P>"); ?>
    
      <?php endwhile; endif; ?>

    Followed by...

    <?php $my_query = new WP_Query('category_name=reviews&showposts=1');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;?>
    
       <div class="post">
    	<div class="storycontent">
    	<CENTER><a href="<?php the_permalink(); ?>"><img class="post-image" BORDER=0 src="<?php post_image('', false, false); ?>"   /></a></CENTER>
    
    	<div class="title" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div>
    
     <TABLE WIDTH="350" BORDER=0 CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER class="story-table"><TR><TD>
    		 <?php the_excerpt_reloaded(35, '', '', true, '>> Read more'); ?>
    		 </TD></TR></TABLE>
    
    		 </div>
    		<?php wp_link_pages(); ?>
            <!--<?php trackback_rdf(); ?>  -->
    
     			</div>
      <?php endwhile; ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post();
      if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    <div class="sub-storycontent">
    <?php c2c_get_recent_posts(3, "<LI>%post_URL% (%post_date%)</LI><BR>","4"); ?>
    </div>
    
      <?php endwhile; endif; ?>
  2. GATEKeeper
    Member
    Posted 7 years ago #

    Never mind - went another route. Surprised though that there were no responses at all...

Topic Closed

This topic has been closed to new replies.

About this Topic