Limiting feed to only certain categories

I’m using the following code to pull articles up for display on my homepage, i’d like to limit it to only two or three categories – can anyone point me in the right direction?

<?php
  $i = 1;
  $my_categories = get_option('of_news_page');
  $wp_query = new WP_Query("cat=' . $my_categories . '&posts_per_page=14");
  while ($wp_query->have_posts()) : $wp_query->the_post();
?>
<?php $image_id = get_post_thumbnail_id();  
   $image_url = wp_get_attachment_image_src($image_id,'large');  
$image_url = $image_url[0];?>
<?php if($i==1) { ?>
<div class="featured_single">
<div class="featured_single_image">
<?php if($image_url) { ?><a class="image_article" href="<?php the_permalink(); ?>"><img src="<?php echo bloginfo('template_directory'); ?>/js/timthumb.php?src=<?php echo $image_url; ?>&amp;h=170&amp;w=255&amp;zc=1" alt="" /></a><?php } ?>
<div class="clear"></div>
<span>Posted in : <?php the_category(', '); ?></span>
<span><?php comments_popup_link('No comments yet', '1 Comment &raquo;', '% Comments &raquo;'); ?></span>
</div>
<div class="featured_single_text">
<span><?php the_time('M j, Y') ?></span>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php wpe_excerpt('wpe_featured_single'); ?> 
<p><a href="<?php the_permalink(); ?>">Read More &raquo;</a></p>
</div>
</div>

<div class="clear"></div>

<div id="featured-posts-news">
<?php } elseif($i>1 && $i<6) { ?>
<div class="featured-post-news-container clearfix">
<?php if($image_url) { ?><a href="<?php the_permalink(); ?>"><img src="<?php echo bloginfo('template_directory'); ?>/js/timthumb.php?src=<?php echo $image_url; ?>&amp;h=120&amp;w=209&amp;zc=1" alt="" /></a><?php } ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

<span><?php the_time('M j, Y') ?></span>

<?php wpe_excerpt('lotf_news_page'); ?><span class="news-morelink"><a href="<?php the_permalink(); ?>">[ Read More &rarr; ]</a></span>

</div>
<?php } ?><?php $i++; ?><?php endwhile; $i=0; ?>
</div>

Related posts

Leave a Reply

1 comment