I am trying to build a custom view of categories, I want to have all 'post's show their thumbnail within a jQuery carosel (4 in each slide) , I have got it to a stage where it visually looks how I want it to look, but it's showing ALL posts rather then the category your on, I have a big feeling this is due to my custom loop oposed the the standard one (I am using twentyten as my base) any ideas what I am doing wrong?
Also on a side note, cat.php (at the bottom) is made by manually adding a post call, with a post offset for each new item added, is there a better way of doing this so I don't need to manually add a case for each post I want to display?
category.php...
<div id="container">
<div id="content" role="main">
<div style="position: relative; margin:0 auto; width: 960px; height:500px;">
<!-- "previous page" action -->
<a class="prev browse left"></a>
<!-- root element for scrollable -->
<div class="scrollable" id="scrollable">
<!-- root element for the items -->
<div class="items">
<?php
$category_description = category_description();
if ( ! empty( $category_description ) )
echo '<div class="archive-meta">' . $category_description . '</div>';
/* Run the loop for the category page to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-category.php and that will be used instead.
*/
get_template_part( 'cat' );
?>
</div>
<!-- "next page" action -->
<a class="next browse right"></a>
</div>
</div><!-- #content -->
</div><!-- #container -->
cat.php (my custom loop)
<div>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php
global $post;
$args = array( 'numberposts' => 1 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<span id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
<?php the_post_thumbnail('large');?>
</a>
</span>
<?php endforeach; ?>
<?php endwhile; // end of the loop. ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php
global $post;
$args = array( 'numberposts' => 1, 'offset'=> 1 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<span id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
<?php the_post_thumbnail('large');?>
</a>
</span>
<?php endforeach; ?>
<?php endwhile; // end of the loop. ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php
global $post;
$args = array( 'numberposts' => 1, 'offset'=> 2 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<span id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
<?php the_post_thumbnail('large');?>
</a>
</span>
<?php endforeach; ?>
<?php endwhile; // end of the loop. ?>
</div>
<div>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php
global $post;
$args = array( 'numberposts' => 1, 'offset'=> 3 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<span id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
<?php the_post_thumbnail('large');?>
</a>
</span>
<?php endforeach; ?>
<?php endwhile; // end of the loop. ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php
global $post;
$args = array( 'numberposts' => 1, 'offset'=> 4 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<span id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
<?php the_post_thumbnail('large');?>
</a>
</span>
<?php endforeach; ?>
<?php endwhile; // end of the loop. ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php
global $post;
$args = array( 'numberposts' => 1, 'offset'=> 5 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<span id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
<?php the_post_thumbnail('large');?>
</a>
</span>
<?php endforeach; ?>
<?php endwhile; // end of the loop. ?>
</div>