Display posts from a single category
-
Right now I have a piece of code on my homepage that is pulling in the most recent posts from a set of categories. However, I only want it to pull in the posts from category #15. Can someone please help me tweak this code to do that?
<?php $allCats = get_categories(); $blogCats = array(); $blogcat = get_cat_ID(get_option('15')); foreach ($allCats as $category) { if (in_subcat($blogcat, $category->cat_ID)) $blogCats[] = $category->cat_ID; } $args = array('category__not_in' => $blogCats, 'showposts' => get_option('portfolio_number')); $i = 1; query_posts($args); if (have_posts()) : while (have_posts()) : the_post(); ?> <?php include(TEMPLATEPATH . '/includes/gallery.php'); ?> <?php $i++; endwhile; endif; wp_reset_query(); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Display posts from a single category’ is closed to new replies.