Custom WordPress category page showing all posts rather than the specified category

Why are you running a complete new query for every single post?

Here is what is happening:

  1. WordPress gets all the posts in the category then gets your template and sees the loop ( if have_posts() etc… ) and says ok I have all these posts from this category now it’s time to display them.

  2. Bam HALT!!! Ok I have these posts but here is another query: get_posts and it is asking me for 1 post but what about all these posts I already have? He must not want them so I will get this one post he wants.

  3. Ok I’m displaying the post he wants just 1 and since no other options were specified I will just grab the most recent post in the database

This repeats for each new query and loop.

WordPress already knows the category you want there is no need to run the get_posts foreach loop with the offsets.

just run:

 <?php   if( have_posts() ) : while (have_posts() ) : the_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  endwhile; endif; ?>

And WordPress will return the number of posts set in your posts per page options settings from what ever category it gets from the url. No need to create a complete new query for each and every post.