My categories structure :
Category 1 (8 Posts )
- subcategory1 (2 Posts)
- subcategory2 (2 Posts)
- subcategory3 (2 Posts)
Category 2 (6 Posts)
- subcategory1 (2 Posts)
- subcategory2 (2 Posts)
- subcategory3 (2 Posts)
I would like to query posts only from the Category 1 (8 posts) and Category 2 (6 Posts) without displaying posts from subcategories.
Here's the code sample :
<?php query_posts( array ( 'category_name' => $cat_slug, 'posts_per_page' => -1 ) );
$number = 0; ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
$title = the_title('','',false);
$excerpt = get_the_excerpt();
echo $title;
echo $excerpt;
?>
<?php endwhile; else: endif; ?>
How can I edit above code to display posts only from categories 1 ,2 , without displaying posts from subcategories ??