Thanks Josh,
I’ve put your code in and it works!! However, there seems to be a slight problem.
I removed the argument line that states ’10 posts per page’ as my wordpress settings has it currently showing just 3 which is fine as i’m building the site on my testing server. There are only 2 posts which meet the arguments criteria (ie. in the current category and not in 46), and although these are now the only ones that are showing, the next_post_link is displaying and linking to a page 2 which again shows the same 2 posts!?
This is strange as there shouldn’t be a page 2 because there are only 2 posts meeting the argument and the settings are set to 3 posts per page. Do you know why it would duplicate the same posts and put them on a second page?
Thanks. The full code is as follows…
<?php
$args=array(
'category__in' => $ps_catid, // Taken from your example above
'category__not_in' => '46' // Taken from your example above
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div class="trends_panel">
<div class="trends_header">
<div class="trends_date">
<?php the_time('F jS, Y') ?>
</div>
<div class="trends_title">
<h1><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
</a>
</h1>
</div>
<?php $image = get_post_meta($post->ID, 'category image', true);
if($image) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<img src="<?php echo $image; ?>" border="0" class="resize" />
</a>
<?php endif; ?>
<div class="trends_excerpt">
<?php the_excerpt(); ?>
</div>
<div class="trends_more">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">Read More
</a>
</div>
</div>
</div>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
<div class="clear">
</div>
<?php previous_posts_link('« More Recent Posts') ?>
<?php next_posts_link('Older Posts »') ?>