Show Category Posts Without Children
-
I am trying to display all posts in a category, without showing the posts in child categories of the parent. https://testing.wearewireless.com under products it shows posts that are in phones which is a sub of products, how do I stop children form showing? Below is my index page:
‘<?php get_header(); ?>
<!– *** –><div class=”clear”></div><!– *** –>
<!– Main Content START –>
<div class=”fwGrid-8″>
<div id=”mainContent” class=”fwVer-10″><!– Featured Post START –>
<?php if($paged==0){include(TEMPLATEPATH.”/featuredpost.php”); } ?>
<!– Featured Post END –><?php
if(get_category($sst_settings[‘sst_news_cat’]))
$query_cat = ‘category_name=’.get_category($sst_settings[‘sst_news_cat’])->category_nicename.’&’;
?><?php query_posts($query_cat.’showposts=’.get_option(‘sst_news_nr_home’).’&paged=’.$paged);
if(have_posts()) : while(have_posts()) : the_post();
if ($post->ID != $featured_ID) { ?><div class=”block”>
<?php if (get_post_meta($post->ID, ‘image_thumb’, true)) { ?>
<div class=”fwLeft newsImg”>
“><img src=”<?php echo get_post_meta($post->ID, ‘image_thumb’, true); ?>” alt=”” class=”fwBorder” />
</div><div class=”newsContent”>
<?php } ?><h1>” title=”<?php the_title(); ?>”><?php the_title(); ?></h1>
<?php if(get_option(‘sst_news_date’) || get_option(‘sst_news_cats’) || get_option(‘sst_news_author’)) { ?>
<small>Posted <?php if(get_option(‘sst_news_date’)) { ?>on <?php the_time(‘M d’); } ?> <?php if(get_option(‘sst_news_cats’)) { ?> in <?php the_category(‘, ‘); } ?> <?php if(get_option(‘sst_news_author’)) { ?> by <?php the_author_posts_link(); } ?></small><?php } ?><?php the_content(‘Read More’); ?> <div class=”separator biggap”></div>
<?php if (get_post_meta($post->ID, ‘image_thumb’, true)) { ?>
</div>
<?php } ?><div class=”clear”></div>
<div class=”blockFooter”>
<?php if(get_option(‘sst_news_comments’)) { ?>
“>Leave a response<span class=”sep”> </span>“><?php comments_number(); ?>
<?php } ?>
</div><!– *** –><div class=”clear”></div><!– *** –>
</div><?php } endwhile ?>
<div id=”posts_navigation”>
<div class=”alignleft”><?php previous_posts_link() ?></div>
<div class=”alignright”><?php next_posts_link() ?></div>
</div>
<!– *** –><div class=”clear”></div><!– *** –><?php else : ?>
<h2 class=”center”>Not Found</h2>
<p class=”center”>Sorry, but you are looking for something that isn’t here.</p>
<?php endif; ?></div>
</div>
<div class=”fwGrid-4″>
<div id=”sidebar”>
<!– Sidebar START –>
<?php get_sidebar(); ?>
<!– Sidebar END –>
</div>
</div>
<!– Main Content END –><!– *** –><div class=”clear”></div><!– *** –>
<?php get_footer(); ?>’
- The topic ‘Show Category Posts Without Children’ is closed to new replies.