i'm working on a wordpress site and want to display 5 latest posts from two categories seperated in 2 unordered lists. below is te code the get the first one:
<?php
$args = array( 'numberposts' => 5, 'offset'=> 0, 'category' => 3 );
$postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<img src="http://www.matejlatin.com/wp-content/themes/matejlatin/timthumb.php?src=<?php echo $image[0]; ?>&h=40&w=40&zc=1"
alt="<?php the_title(); ?>" class="footer-thumb" /></a>
<div class="recent-post-content">
<p><?php the_time('j. F Y') ?> : <?php if(function_exists('the_views')) { the_views(); } ?> : <?php comments_number('0 comments','1 comment','% comments'); ?></p>
<p><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
</div>
</li>
<?php endforeach; ?>
the problem is that when I copy paste this code (and change the category ID) for the second list of the other category it somehow "overwrites" the first one and displays only recent posts from the second category.
Can anyone help me make this work?