• I have been trying to customize my index page so that the loop does does this

    • Show single most recent post – do not duplicate
    • Show single most recent post with ‘features’ category – do not duplicate
    • Show single most recent post with ‘radio’ category – do not duplicate
    • Show remaining recent posts

    I tried the Magazine theme but I couldn’t get it to separate by category. I finally went back to the default theme and was able to get it to place the most recent post by category ‘features’ and the remaining posts. Still can’t figure out how to do what I need it to do though.

    I’ve gone though the loops tutorials and read a number of articles on multiple loops but I seem to be missing something. Any suggestions?

Viewing 1 replies (of 1 total)
  • Thread Starter bmpavel

    (@bmpavel)

    Here is the code I used to modify the Kubrick theme to give me part of what I am looking for

    <?php $my_query = new WP_Query('category_name=breakingsports&showposts=1');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;?>
        <!-- Do stuff... -->
      <?php endwhile; ?>
        <!-- Do other stuff... -->
        <!-- Want to add 2nd single Category post here... -->
        <!-- Do other stuff... -->
        <div class="mainTsdContent">
      <div class="goldBtmBorder">
      <span class="titleBar">RECENT STORIES</span>
      </div>
      <?php if (have_posts()) : while (have_posts()) : the_post();
      if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
       <!-- Do stuff... -->
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php include (TEMPLATEPATH . "/searchform.php"); ?>
    
    	<?php endif; ?>

    If I duplicate the first query

    while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;?>

    It duplicates the selected category posts into the third section.

    Any thoughts?

Viewing 1 replies (of 1 total)

The topic ‘Loop for multiple catagorie recent posts’ is closed to new replies.