How can I create a loop to build slides based on multiple categories using Coda Slider

For those who were interested in an answer to this question, I found the answer myself.

<div class="coda-slider"  id="slideshow">    

<?php
// array of category IDs
$categories =  array(1,2,3,4,5);

foreach ($categories as $cat) :
  $post = false;
  $post = get_posts('cat=".$cat."&posts_per_page=1');
  if($post) :
    $post = $post[0];
    setup_postdata($post); ?>

    <!-- rest of normal loop -->

    <div <?php post_class(); ?>>
      <h2 class="title">title used to dynamically generate thumbs in codaslider</h2>
      <h3><a href="https://wordpress.stackexchange.com/questions/71760/<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
      <?php the_content(); ?>
    </div>

  <?php endif; ?>
<?php endforeach; ?>  

</div>

The original foreach loop code came from this post:

http://wordpress.org/support/topic/display-most-recent-post-from-each-of-several-categories-on-home-page

Leave a Comment