<?php
if (is_page('21') ) {
$cat = array(12);
} elseif ( is_page('16') ) {
$cat = array(32);
} elseif ( is_page('28') ) {
$cat = array(17);
} else {
$cat = '';
}
$showposts = -1; // -1 shows all posts
$do_not_show_stickies = 1; // 0 to show stickies
$args=array(
'category__in' => $cat,
'showposts' => $showposts,
'caller_get_posts' => $do_not_show_stickies,
);
$my_query = new WP_Query($args);
?>
<?php if( $my_query->have_posts() ) : ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php
//necessary to show the tags
global $wp_query;
$wp_query->in_the_loop = true;
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<div id=news><h2><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h2></a></div>
<?php the_excerpt(); ?>
<h4><span id=news>Written by <?php the_author();?> at <?php the_time();?> <a>" rel="bookmark">Read More....   <?php comments_number(); ?></a> </span></h4>
<?php endwhile; else: ?>
<div id=footerbg">
<div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
I want this to only show posts from a certain catagory.
I cant seem to find how to do it?
This code is from my Page.php.