I wanted to list posts which are directly under a category and not inside the "sub category". In other words, I want to hide all the posts which are from "Sub Category" in the Parent category view.
My looping code is below.
<?php rewind_posts(); if (have_posts()) : while ( have_posts() ) : the_post(); global $post; ?>
<?php get_template_part('includes/loop'); ?>
<?php endwhile; wp_reset_query(); ?>
<!-- loop.php -->
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" rel="bookmark">
<?php the_post_thumbnail('home-entry-thumb', array('class' => 'entry-thumb')); ?>
</a>
<h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="entry-excerpt">
<?php the_excerpt(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'themejunkie' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-excerpt -->
<div class="clear"></div>
</div><!-- #post-<?php the_ID(); ?> -->